Solved

Nesting cfloop queries

Posted on 2014-03-17
3
255 Views
Last Modified: 2014-03-18
Hello.

I need to do the following:

I have  MyTable structured like this.

ID      NumImages
a          3
b          6
c          4

I want to output each ID as many times as there is NumImages.recordcount ,output it as a1,a2,a3  then output the next ID NumImages.recordcount as b1,b2,b3...



Trying to achieve this result:

a1
a2
a3

b1
b2
b3
b4
b5
b6

c1
c2
c3
c4

I have tried all kings of nesting cfoutputs, cfloops, cfoutput loops..I just don't get it.
Hope this makes sense.
Can you help?
0
Comment
Question by:izweig
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 39936140
Do a regular query loop, then within it loop from=1 to=#NumImages#

<cfoutput query="yourQuery">
      <cfloop from="1" to="#NumImages#" index="counter">
           #yourQuery.id##counter#<br/>
      </cfloop>
      <!--- extra break between id's --->
      <br/>
</cfoutput>
0
 

Author Closing Comment

by:izweig
ID: 39936751
Awesome thanks.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39936847
Welcome.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now