Solved

COLDFUSION GENERATE RECORDS FROM QUERY

Posted on 2007-04-02
4
166 Views
Last Modified: 2013-12-16
I have a table with following data:
Lot - Start_Number - End_Number - Value
100 - 1                   - 50                  - 3
200 - 101               - 250                - 5
300 - 501              - 750                - 8
And i need to generate the records from each one of the lines up to the end number. The result has to insert into my DB records like this:
Lot - Secuence-Value
100 - 1 - 3
100 - 2 - 3
100 - 3 - 3... and so on until secuence is = end_number and then go to next line and generate...
200 - 101 - 5
200 - 102 - 5
200 - 103 - 5 and so on...
Thanks
WmV
0
Comment
Question by:wvalencia
  • 3
4 Comments
 
LVL 5

Accepted Solution

by:
rucky544 earned 200 total points
ID: 18842503
<cfloop query="queryname">
  <cfloop from="Start_number" to="End_Number" index="index">
     <cfquery name="insert_data" datasource="yourDSN">
        insert into yourtablename (lot, secuence, value)
        values (#lot#, #index#, #value#)
     </cfquery>
   </cfloop>
</cfloop>
0
 
LVL 5

Expert Comment

by:rucky544
ID: 18842513
It loops over the query, then loops from the start number to the end number and inserts a row for each one, index is the values beween start and end numbers.

That should work for you
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 50 total points
ID: 18844952

 Small type-o, don't forget the #'s in the loop..

<cfloop from="#Start_number#" to="#End_Number#" index="index">


 (no points pls)
0
 
LVL 5

Expert Comment

by:rucky544
ID: 18846548
oh yeah thanks for spotting that gdemaria
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show "Processing please wait" while CFGRID getting ready to load 23 105
recordcount is coming as undefined in query 4 60
cfspreadsheet 15 84
Web Development Tools for MVC 3 75
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…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

919 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

22 Experts available now in Live!

Get 1:1 Help Now