Reply to topic
Rank Query Results
Jeremy23


Joined: 21 Feb 2006
Posts: 24
Location: Overland Park, KS
Reply with quote
This seems like an easy thing, I've checked dozens of forums, but can't find what I'm looking for.

I have a cfoutput query of results. and i just want to number the results in order 1, 2, 3 etc. I have a drop down box that will change the rank the results based on what they choose.

All I'm looking for is to show that rank depending on what the user chooses. It will always be 1, 2, 3 etc. but the record order changes depending on the drop down box. I thought it was as easy as a cfloop with a counter adding +1, but how do i mesh that with a cfoutput query. Or can I not do that.

Thanks for the help.
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 548
Location: Harrisburg, PA
Reply with quote
Not sure I completely understand.. Do You mean you want to number the results?

Like

1. Page 1

2. Page 2

3. Page 3

4. Page 4

Or do you want to some how re order the results?
Jeremy23


Joined: 21 Feb 2006
Posts: 24
Location: Overland Park, KS
Reply with quote
sorry for the confusion.

i just want to order the results

1
2
3
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 548
Location: Harrisburg, PA
Reply with quote
Jeremy23 wrote:
sorry for the confusion.

i just want to order the results

1
2
3


ohhh ok. If you are looping through a query you just use "Current Row"

Code:

<cfloop query="MyQuery">
  <!--- First outputs the row number, then the page name --->
  <li>#MyQuery.CurrentRow#. - #MyQuery.Pagename#</li>
 
</cfloop>


If you were looping through a plain loop (Not a query)..

Code:

<cfloop from="1" to="100" index="i">
 <cfoutput>
 This is Loop Number #i#
</cfoutput>

</cfloop>


Give that a shot. Smile
Jeremy23


Joined: 21 Feb 2006
Posts: 24
Location: Overland Park, KS
Reply with quote
Thanks a bunch! I knew it was easy. Stupid mind blocks. Sometimes the easiest thing is right in front of your face.

Thanks
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 548
Location: Harrisburg, PA
Reply with quote
Indeed! No Problem Cool Even us experienced CF'ers hit mind blocks on the little things that are so obvoius
Rank Query Results
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic