EasyCFM.COM ColdFusion Forums / Coding Help! / Conditional Processing

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Conditional Processing

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

vijayar
12-02-2002 @ 12:09 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 3
Joined: Nov 2002

Hello:
I have this website, where in page 1 some itemid is entered. After saying submit, it goes to the next page 2. In page 2 I have a query which will retrieve all the itemids from the database. Now if only 1 record is returned it should go to page 3 directly, othersie it shouls list all the itemids returned. I used the following code

get is the query which gets itemids from the db.
<CFSET numrec = get.RecordCount>
<CFOUTPUT>#numrec#</CFOUTPUT>
<cfif numrec is not 1>
<cfoutput query="get">
#courseid# </cfoutput>
<cfelse>
I dont know how to do this: it should go to page 3 directly
</cfif>
Please can you help!!!



              

vijayar
12-02-2002 @ 8:16 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 3
Joined: Nov 2002

Hi Pablo:

Thanks a lot for your solution but I am also concerned about the first part of the code.

(All this code is on page 2)
get is the query which gets itemids from the db.

<CFSET numrec = get.RecordCount>
<CFOUTPUT>#numrec#</CFOUTPUT>

<cfif numrec is not 1>
<cfoutput>These are the items you have requested
<cfoutput query="get">
#courseid# </cfoutput>
</cfoutput>
(At this point it says that nested query processing is not possible.)

<cfelse>
<cflocation url="page3.cfm">
</cfif>

From page 1 all the itemids go into the database and all the values are retrieved in page 2 and displayed as form parameters. One is selected and this is passed as #form.itemid# to page 3. However in case of only 1 itemid it goes directly to page 3, and I am getting an error mesage becoz the page 3 is still looking for a #form.itemid# which I dont know how to define now.
On page 3 I would have #form.itemid# from page 2 in 1 case and from the query #get.itemid# in the 2nd case. Am I correct?
Can you help!!!!
Thanks a lot.
Confused Confused Smile


Website Designed and Developed by Pablo Varando.