ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 9th, 2005, 08:07 AM
nhrrdan nhrrdan is offline
Coldfusion Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: New Hampshire
Posts: 62 nhrrdan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 46 m 53 sec
Reputation Power: 6
Send a message via AIM to nhrrdan Send a message via Yahoo to nhrrdan
MySpace Orkut
Question Not displaying a link after completion

I have an issue that has been frustrating me for a little while. I am rewriting an online assessment testing system that is used to get an idea of a potential prospects skill level. I am trying to set up this system to be completely user friendly and customizable.

The problem I'm having is this. When someone takes a test it gets graded and inserted into an access database table called grades upon completion. I want to query that table to see what tests that person has completed. After that I want to be able to show the user what has been completed and what has not. Because an unlimited amount of tests can be created by an administrator, it also has its own table in the database. When I try to match these two tables up to only display a link to tests that have not been taken, it only blocks the first one it sees from the query. For example, if a user takes tests 2, 4 and 5. Using the code below it only blocks the link for test # 2. This is what I have for code:

Code:
<cfset testarray=arraynew(1)>
<cfset testarray2=arraynew(1)>

<cfloop query="tests">	
   <cfset testarray[CurrentRow][1]=testtitle>
   <cfset testarray2[CurrentRow][1]=testtype>
</cfloop>

<cfset total_records=tests.recordcount>
<cfloop index="Counter" from=1 to="#Total_Records#">
			  
			  <tr>
				<td valign="top">
				<cfif #grades.testtype# neq #testArray2[Counter][1]#>				
<a href="javascript:win('testing/test.cfm?recordID=<cfoutput>#testArray2[Counter][1]#</cfoutput>&testtitle=<cfoutput>#testArray[Counter][1]#</cfoutput>')"><cfoutput>#testArray[Counter][1]#</cfoutput></a>
				</cfif>
				<cfif #grades.testtype# eq #testArray2[Counter][1]#>
				<cfoutput>#testArray[Counter][1]#</cfoutput> Complete
				
</cfif>	
</td>
</tr>
				
			  
</cfloop>


I found this code in the documentation, but I don't even know if it is the right process for this type of action.

Any help would be greatly appreciated.
__________________
Dan Arsenault
www.dasignz.com
blog.dasignz.com

Reply With Quote
  #2  
Old February 9th, 2005, 08:16 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 42 m 54 sec
Reputation Power: 53
Yes I don't understand what you're doing with the arrays. If you have a query that shows records for all of the tests the user didn't take, why not just loop over the query and output it?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old February 9th, 2005, 08:37 AM
nhrrdan nhrrdan is offline
Coldfusion Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: New Hampshire
Posts: 62 nhrrdan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 46 m 53 sec
Reputation Power: 6
Send a message via AIM to nhrrdan Send a message via Yahoo to nhrrdan
MySpace Orkut
Quote:
Originally Posted by kiteless
Yes I don't understand what you're doing with the arrays. If you have a query that shows records for all of the tests the user didn't take, why not just loop over the query and output it?


First off, thanks for the response and you make it sound so easy . I have tried simple loops and have had no luck. This was my last attempt at it and I posted what I tried, I've been banging my head on the wall for at least a week on this. Everything I've tried only blocks the link for the first one the loop catches in the query. I'll try to explain what I am trying to do a little better.

1. There are a number of tests that are in the "tests" table which have been created by the test administrator.
2. A user takes a test.
3. Grade and testtype for test get inserted into "grade" table.
4. Users main page queries the "grade" table and compares it to all tests in the "tests" table.
5. Users main page shows tests not taken (and a visual confirmation of what tests have been taken).

I might have to try a different angle on this one anyway because I just found out that I am going to have tp assign certain users to certain tests which may throw all of this out of whack.

Again, Thanks for all your help.

Reply With Quote
  #4  
Old February 9th, 2005, 10:37 AM
Shane_Z Shane_Z is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: In denial
Posts: 22 Shane_Z User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 57 m 52 sec
Reputation Power: 0
Send a message via MSN to Shane_Z
You create 1-d arrays for test title and type, yet access them as a 2-d arrays?

Code:
 

<cfloop query="tests">	
   <cfset testarray[CurrentRow]=testtitle>
   <cfset testarray2[CurrentRow]=testtype>
</cfloop>


I think that may work a little better for you. The code in your cfif blocks will need to be changed as well. Maybe that will help?

Reply With Quote
  #5  
Old February 9th, 2005, 11:39 AM
nhrrdan nhrrdan is offline
Coldfusion Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: New Hampshire
Posts: 62 nhrrdan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 46 m 53 sec
Reputation Power: 6
Send a message via AIM to nhrrdan Send a message via Yahoo to nhrrdan
MySpace Orkut
Thumbs up

Quote:
Originally Posted by Shane_Z
You create 1-d arrays for test title and type, yet access them as a 2-d arrays?

Code:
 

<cfloop query="tests">	
   <cfset testarray[CurrentRow]=testtitle>
   <cfset testarray2[CurrentRow]=testtype>
</cfloop>


I think that may work a little better for you. The code in your cfif blocks will need to be changed as well. Maybe that will help?


Thanks! That did work. I'm still trying to figure out this whole array thing. Still new to this sort of thing.

Reply With Quote
  #6  
Old February 9th, 2005, 12:37 PM
Shane_Z Shane_Z is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: In denial
Posts: 22 Shane_Z User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 57 m 52 sec
Reputation Power: 0
Send a message via MSN to Shane_Z
good job! glad that helped you out.

Reply With Quote
  #7  
Old February 9th, 2005, 01:25 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 42 m 54 sec
Reputation Power: 53
I'm glad that you found a way to make it work, but it still seems odd to me. If you have a table with all possible tests, and you have a table for all the tests a user took, you can write a query to give you back only the tests the user didn't take (tests which exist in the full test table but do not exist in the user's tests table). This could be done with an outer join, or an EXISTS clause, or a subquery. If it's working now you might not want to worry about it but for future use, these would probably be more efficient.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Not displaying a link after completion


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT