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
Solved

COLDFUSION GENERATE RECORDS FROM QUERY

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Query help 4 81
javascript to html map 8 93
Problem with data displaying 2 28
Using coldfusion <cfexecute> to restore mysql database 7 47
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
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 …
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

840 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