|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Looping over a CFoutput
At the livedocs it says that when you loop over a CFoutput the maxrows no longer works, and i'm running into that problem...I can't seem to come up with a fix for it either, anyone with any logical ideas?
Thanks Caden |
|
#2
|
|||
|
|||
|
Are you sure? This doesn't mention anything about that:
http://livedocs.macromedia.com/cold...309.htm#1101659 But if it's really an issue, can't you just use a cfloop instead, keep track of a counter, and when you hit your limit just break out of the loop with cfbreak?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
check here
at the bottom of the page, it might just be some guy, and he mentions it in nested cfoutputs, but I think I still might be right...since it isn't working for me, but using a flag and cfbreak as you suggested worked fine. Also, I figure if the guy was wrong, the macromedia team would have removed it from the page, I might be wrong. |
|
#4
|
|||
|
|||
|
I have a somewhat strange and silly question... when would you want to use maxrows on a cfoutput? I have used it in CFQuery, but why use it in cfoutput? I am just curious since I have never used maxrows in that tag...
Thanks for indulging in my lack of knowlege. But anyways, I agree with using a counter, I am used to other programming languages where that is needed or even using a cfloop with a from/to clause... Ok I will be quiet now... -Matt http://www.LearnFamily.com |
|
#5
|
|||
|
|||
|
Well, here is the code
<cfset jflag = 0> <cfset result = #ArrayClear(result)#> <cfset result = ArrayNew(1)> <cfoutput query="quote"> <cfset arrayAppend( result, quote.key )> </cfoutput> Quote:<br><br> <cfset j = 0> <cfloop from="1" to="#ArrayLen(result)#" index="j"> <cfquery datasource="numberonerule" name="every"> Select ID, Name, Quote, Category, Topic From Quote where id = #result[j]# </cfquery> <cfif jflag eq 3> <cfbreak> <cfelse> <cfoutput query="every"> <span class="maintext"> <cfset jflag = jflag +1> Name: #Name#<br> Quote: #quote#<br><br> </span> </cfoutput> </cfif> </cfloop> The problem is this...I have 3 verity collections, and when I did a search inside of that collection everything works. But I wanted to orginize the data under 3 headings... The problem is, when you do a search and then use the "key" function you pull the ID of the record that you pulled, but there was no way I found that I could take that number and toss it into a query, and the only way I could see that number was inside an output so I felt the best way to go about that would be to loop over the output using an array to store the ID taking the ID everytime the output itself loops to dish out more information and throw it into a query. Kiteless in Kiteless' infinate wisdom then came along and helped me out with that until we have what you see above which works perfectly. So, now I can do a search, hit 3 verity collections and toss the results into the proper spot they fit, as an example, the database has the fields, name, category and topic...if you search for "bill" and it is found in any of thoes fields it will display now under the headings on the page... so... Name result result Category result Topic result result result or whatever...sorry if that explanation sucks...but, follow me? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Looping over a CFoutput |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|