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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFSET where I don't know what I'm setting... 3

Status
Not open for further replies.

KevinFSI

Programmer
Nov 17, 2000
582
US
I have a query that returns (for arguments sake) 2 records. I want to be able to loop through the two records and CFSET them to two distinct variables. Lets say I want the first record to be "sim1" and the second to be "sim2" If my query returns more records, I want to increment sim3, sim4, etc...

How can I set those variables in the loop and use them later?

I know I can output the results of my query in a loop, but I need to be able to set them to their own individual variables. Kevin
slanek@ssd.fsi.com
 
Hey Kevin,

Is this what you need?

<cfoutput query=&quot;q1&quot;>
<cfset &quot;sim#q1.currentrow#&quot; = q1.myVar>
</cfoutput>

<cfloop index=&quot;x&quot; from=&quot;1&quot; to=#q1.recordcount#>
<cfoutput>#evaluate(&quot;sim#x#&quot;)#</cfoutput>
</cfloop>

Hope this helps,
GJ
 
YES, YES, YES!!!!!!!!

I now see the light. You've bailed me out once again! How the HåLL do you do it? ;-) Kevin
slanek@ssd.fsi.com
 
My epsilon character didn't turn out right, it was supposed to be an E. You get my point though. Thanks again! Kevin
slanek@ssd.fsi.com
 
Glad to help! I've been coding since version 1 so I've picked up a few things over the years :)

GJ
 
I guess. Man, you've been a life-saver several times. Kevin
slanek@ssd.fsi.com
 
I'm glad I could help out. I feel like this is a way for me to pay back all those who helped me out along the way when I had strange problems on Linux and other areas. I've fixed sooooo many problems because I found someone posted the same problem on a bulletin board somewhere. I don't see how people functioned before the Internet :)

Happy coding,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top