Solved

Nesting cfloop queries

Posted on 2014-03-17
3
261 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

729 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