The problem lies in your CFSET statement between the queries.  You are
setting client.gradingPeriod to the first value returned by the previous
query.  Thus when you reference the second query's values in the IF
statement they will always be the same.  You should not be running two
seperate queries, but rather joining the appropriate tables in a single
query and manipulating the output using CF. 

                                                    
Bryan Love ACP
Internet Application Developer
[EMAIL PROTECTED]
                                                    


-----Original Message-----
From: Janine Jakim [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 03, 2001 12:33 PM
To: CF-Talk
Subject: query and cfif and cfset


I have a display page that I want the user to only add current information.
The older info should be read only.  I can not seem to get this to work- i
end up with either 2 input boxes or 2 display boxes.  I'm wondering if the
prob stems from the queries.
1.  I used two queries.  One gives all the fields that are going to be
updated. (it has 2 tables) and the 2nd query has the dates of the quarters
and cut-offs for data entry.  This 2nd one has a where statement for
client.quarter = quarter between the 2 queries.
2. On my display page I output the data entry query.  Where it should
display I have:

 <CFIF (Now() GT CLIENT.BegQuarter) and (Now() LT CLIENT.DistributionDate)
and (CLIENT.GradingPeriod EQ 1)><INPUT name="GradeForSubject"
value="#UCase(GradeForSubject)#" size="5">
<CFIF (Now() GT BegQuarter) and (Now() LT DistributionDate) and (Quarter EQ
2)><INPUT name="GradeForSubject" value="#UCase(GradeForSubject)#" size="5"> 
<CFELSE>#GradeForSubject#
</CFIF>

This will not work.  I assumed it was because I am doing a cfoutput query on
the 1st query but then had field names from the 2nd query.  I then changed
the 2nd query variables to CLIENT variables but that didn't make any
difference.  (Above is the old code before I cfset the client variable)
So do I need to combine the queries?  I'm afraid that the queries are going
to get too big/slow...(
Here are the queries I used.  Any help would be great as I've been cursing
this thing all day...

Query 1:
<CFQUERY NAME="GetSubjects" DATASOURCE="#Request.maindsn#">
SELECT      tbl_StudentGrade.GradesID, tbl_StudentGrade.SkillID,
tbl_CourseSkill.Skill, tbl_CourseSkill.CourseID, tbl_CourseSkill.DisplayNum,

tbl_StudentGrade.GradeForSubject, tbl_StudentGrade.SchoolDates,
tbl_StudentGrade.Advisor, tbl_StudentGrade.GradingPeriod,
tbl_StudentGrade.PERMNUM
FROM         tbl_CourseSkill, tbl_StudentGrade
WHERE    tbl_CourseSkill.SkillID = tbl_StudentGrade.SkillID and
PERMNUM='#PERMNUM#' And CourseID=1  OR  tbl_CourseSkill.SkillID =
tbl_StudentGrade.SkillID and  PERMNUM='#PERMNUM#' And CourseID=2
Order BY DisplayNum, GradingPeriod
</CFQUERY>

<CFSET CLIENT.GradingPeriod=GetSubjects.GradingPeriod>

QUERY2:  
<CFQUERY NAME="GetQuarters" DATASOURCE="#Request.maindsn#">
SELECT BegQuarter, EndQuarter, DistributionDate, Quarter
FROM tbl_QuarterDate
WHERE Quarter= #CLIENT.GradingPeriod#
</CFQUERY>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to