Solved

Nesting cfloop queries

Posted on 2014-03-17
3
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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