Solved

COLDFUSION GENERATE RECORDS FROM QUERY

Posted on 2007-04-02
4
167 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

810 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