Molly,
> <cfquery name="getproposals" datasource="sotl">
> select *
> from proposal06
> where readinggroup = #session.group#
> and status = 1
> order by proposalid asc
> </cfquery>
>
> <cfset proposals = ''>
>
> <cfoutput query="getproposals">
> <cfset proposals = '#listappend(proposals,proposalid)#'>
> </cfoutput>
>
This loop here, can be replaced with <cfset proposals =
ValueList(getProposals.ProposalID)>
> <cfloop list="#proposals#" index="i">
> <cfquery name="getgrades" datasource="sotl">
> select #i#
> from grades06
> where readerid = #session.readerid#
> </cfquery>
> <cfloop list="#getgrades.columnlist#" index="i">
You've got a bit of a problem here..... Your outer loop for the list of
proposals uses a variable "i" for the current ProposalID in the list
called "Proposals". Your inner loop for the columns gained from the
getGrades query also uses "i" in its loop. This will overwrite the
contents of i when you hit the inner loop, plus its also making your
code difficult to read. Call your index variables something a little bit
more meaningful, for instance in the outer loop replace i with
thisProposalID and in the inner loop, thisGradeColumnName.
It should also be noted that you will only get one column in the
getGrades query. That column will be the same name as the contents of i
in the list of proposal IDs and your getIndiv query will therefore be
identical to that of the getGrades query.
I hate to say it, but I don't think any of your code after the
getProposal query is working the way you intend it to.
What are the columns in both proposal06 and grade06 and can you give us
an example of the data you seen in these tables for one proposal?
I'm inclinded to think that you need a JOIN of some kind in your SQL
between the proposal and grade tables eg.
SELECT {columnlist}
FROM proposal06 AS P
LEFT JOIN grades06 AS G ON P.ProposalID = G.ProposalID
WHERE P.readinggroup = #session.group#
AND P.status = 1
AND G.readerID = #session.readerid#
ORDER BY P.ProposalID
where {columnlist} is the columns you need to display from the two tables.
You would then output the proposals and grades something like this :
<cfoutput query="ProposalGrades">
#ProposalGrades.ProposalTitle# -
<select name="#ProposalGrades.ProposalID#>
<option value="1" #IIF(ProposalGrades.Grade EQ
1,DE('selected'),DE(''))#>Accepted</option>
<option value="0" #IIF(ProposalGrades.Grade EQ
0,DE('selected'),DE(''))#>Reject</option>
<option value="2" #IIF(ProposalGrades.Grade EQ
2,DE('selected'),DE(''))#>Maybe</option>
<option value="3" #IIF(ProposalGrades.Grade EQ "" OR
ProposalGrades.Grade EQ 3,DE('selected'),DE(''))#>Not Yet Graded</option>
</select>
</cfoutput>
Its not an ideal solution, but its probably more towards where you need
to be.
Hope that helps
Regards
Stephen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225601
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54