I have an idea.

List Functions.

I'm assuming a bit, so let me know if I'm wrong (and I'm sure that others
have a less cumbersome way to deal with your problem too, so don't think
what I'm saying is at all the only way).

I'm assuming that Quantity looks something like this: 1,2,3,4,5
And Item number looks somethiing like this: F004,F005,F006,F007

And F004 has a quantity of 1; F005 has a quantity of 2 etc.

Take a look at this code... I've mocked up the same functionality.... set a
counter, incremented the counter while looping over one of my lists and then
used that counter to retreive a list element at the poisitoin represented by
the counter.

<cfset list1 = "1,2,3,4">
<cfset list2 = "mom,pop,dad,sis">

<cfset counter = 1>
<cfloop index="qty" list="#list1#">
        <cfoutput>
                        Counter = #counter#             Qty = #qty#
list2 = #ListGetAt(list2, counter)#<br>
        </cfoutput>     
        <cfset counter = counter + 1>
</cfloop>


Output looks like:

Counter = 1 Qty = 1 list2 = mom
Counter = 2 Qty = 2 list2 = pop
Counter = 3 Qty = 3 list2 = dad
Counter = 4 Qty = 4 list2 = sis

So all you'd have to do is loop over your quantity, find the representative
list element and then input both into the db via your query, which is of
course nested in the loop.

-Patti
|-----Original Message-----
|From: Shannon Carr [mailto:[EMAIL PROTECTED]]
|Sent: Tuesday, March 06, 2001 9:02 AM
|To: CF-Talk
|Subject: Re: Loops and Update queries
|
|
|Hi Patricia,
|
|No errors, just not sure how to write the syntax to make it work. The
|problem I'm having is inputing a quanity in a form that was 
|generated by a
|loop, then on the next page updating a table where the 
|Quantity is paired
|with Item_Number.So far I can produce what I need in two 
|separate places.
|Don't know how to combine the two.
|
|Note - F004 should have Quantity of 1
|F065 Quantityof  2
|A400 Quantity of 3
|
|ACTION PAGE TOP:
|<cfloop index="The_Item_Number" list="#ITEM_NUMBER#" delimiters=",">
|#The_Item_Number#<br>
|</cfloop>
|
|<cfloop index="TheQuantity" list="#QUANTITY#" delimiters=",">
|  UPDDATE   BOM
|      SET  QUANTITY = '#TheQuantity#'
|   WHERE  DRAWING_NUMBER = '#DRAWING_NUMBER#' AND ITEM_NUMBER = ???
|</cfloop>
|
|ACTION PAGE DISPLAY:
|F004
|F065
|A400
|UPDDATE BOM SET QUANTITY = '1' WHERE DRAWING_NUMBER = 3000-04
|
|UPDDATE BOM SET QUANTITY = '2' WHERE DRAWING_NUMBER = 3000-04
|
|UPDDATE BOM SET QUANTITY = '3' WHERE DRAWING_NUMBER = 3000-04
|
|
|
|----- Original Message -----
|From: "Patricia Lee" <[EMAIL PROTECTED]>
|To: "CF-Talk" <[EMAIL PROTECTED]>
|Sent: Monday, March 05, 2001 5:48 PM
|Subject: RE: Loops and Update queries
|
|
|> ARe you experiencing an error during some part of the 
|process?  Is it a
|sql
|> problem or a cf / display problem?  More detailed information please?
|> Inluding any error messages if applicable...
|>
|> |-----Original Message-----
|> |From: Shannon Carr [mailto:[EMAIL PROTECTED]]
|> |Sent: Monday, March 05, 2001 4:17 PM
|> |To: CF-Talk
|> |Subject: Loops and Update queries
|> |
|> |
|> |I am trying to update a table using values that were input on
|> |a form using
|> |<cfloop> .
|> |
|> |On the input form I am using a loop query to output the Item_Number,
|> |Item_Description and Quantity fields. The user can update 
|the quantity.
|> |
|> |On the second page I would like to display inside a table, the
|> |variables for
|> |confirmation, then update the table once confirmed. I am
|> |having a problem
|> |parsing the Item_Number and Quantity fields together on the 
|display and
|> |table update. The table being updated does not have a unique ID.
|> |
|> |
|> |INPUT PAGE:
|> |
|> |<cfloop query="itemsbydrawing">
|> |     <tr bgcolor="#IIf(CurrentRow Mod 2, DE('ffffff'),
|> |DE('#tr_color2#'))#">
|> |      <td nowrap>&nbsp;#item_number#</td>
|> |      <td nowrap>&nbsp;#Item_description#</td>
|> |      <td nowrap align="center">
|> |      <input type="Text" name="Quantity" value="#Quantity#" size="4"
|> |maxlength="6"
|> |       onFocus="window.status='Quantity'; return true"></td>
|> |      <td width="100%">&nbsp;#CurrentRow#</td>
|> |      <!--- <td align="center" nowrap>
|> |      <cfinput type="CheckBox" name="DeleteItem" 
|value="yes"></td> --->
|> |
|> |     </tr>
|> |     <input type="hidden" name="ITEM_NUMBER" value="#ITEM_NUMBER#">
|> |     <input type="hidden" name="ITEM_DESCRIPTION"
|> |value="#ITEM_DESCRIPTION#">
|> |     </cfloop>
|> |
|> |
|> |Any help would be appreciated.
|> |
|> |Thanks,
|> |Shannon
|> |
|> |
|> |
|>
|>
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to