Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP IN CFIF STATEMENT - PLEASE HELP !!!

Status
Not open for further replies.

kingjjx

Programmer
Sep 18, 2001
181
US
Hi, I have a table field that may contain upto 5 codes separated by commas (1,2,3,4,5)

I want to output Image 1 If code 1 is found, output Image 2 if COde 2 is found, output image 3 if code 3 is found and so fourth ...
BUT I want it to output 3 images if 3 codes are found, 1 image if only one code is present.

I am close to doing this already but, the problem with my code is if the code found is (1,2,3) it only outputs image 1.

Please help !!!!
thank

 
i dunno why people make things so complicated! ;(
dude, read about LISTS in coldFusion, i guess that will help you doing you job.
 
yeah, go download the CFML reference. I always check that first. lists are pretty simple once you get into them.
 
I already got the answer for this one .. thanks
my new problem is :


Hi, I have a query page that has a radio button to search for BIKES, AUTOS OR ALL

The field it is going to query from has a list of codes [1,2,3,4,5 . .etc]

I want to return BIKES if codes found are between 1-39
and return AUTOS if codes found is 40 and above
and return ALL products too as the third option.

I guess I could also just look for just the first code it finds, and if it is between 1-39, return BIKES and 40 and above return AUTOS.

How can I write this conditional statement?

thank you
 
One option is to get the length of your list, then loop your output that many times - thus evading cfif altogether. Something like:

<CFSet howmanyineed='#listlen(tablefield)#'>
<CFLoop index=thecount from=1 to=#howmanyineed#>
output image code for #thecount#
</cfloop>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top