Let me try again, and see if I dont confuse you this time:

<!--- make the  structure --->
        <cfset newBasket = queryNew("productID, quantity")>
        <cfset session.basket = newBasket>
<!--- add data to it --->
        <cfset tempvalue = queryAddRow(session.basket)>
        <cfset tempvalue = querySetCell(session.basket, "#form.productID#", 
"#form.quantity_text#", AllowOverWrite)>

Now, I need to take another FORM.productID, see if a record with the same ID
exists, and if so, add FORM.quantity to the second column in the structure,
given that ProductID is the first

In your example below, it would be searching for the record "Chris" and if it
existed, adding something to the record "Cortes".

Thank you for all of your help

On Sat, 09 Sep 2000, Chris Cortes spake thusly:
> Jon,
> 
> I am sorry, I made some incorrect assumptions about what you were trying to
> do. I think what you want to do is check to see if an Item exists in the
> Structure and then update its' value if it does. If this is correct the
> following code should help you out.
> 
> 
> <cfscript>
>  // Create your structure...
>  MyStruct = StructNew();
> 
>  MyStruct.FName = "Chris";
>  MyStruct.LName = "Cortes";
> </cfscript>
> 
> <!--- Lets output the structure to see how it looks... --->
> Before the update:<br>
> <cfloop list="#structKeyList(MyStruct)#" index="i">
> 
> <cfoutput>MyStruct.#i#</cfoutput>&nbsp;=&nbsp;<cfoutput>#evaluate("MyStruct.
> #i#")#</cfoutput><br>
> </cfloop>
> <br>
> 
> <cfscript>
>  // Lets find the key and make the update if it exists...
>  Form.Field = "Fname";
> 
>  if(StructKeyExists(MyStruct,Form.Field)){
> 
>   "MyStruct.#Form.Field#" = "Christopher";
> 
>  }
> </cfscript>
> 
> <!--- Lets output the structure to see if the update was successfull... --->
> After the update:<br>
> <cfloop list="#structKeyList(MyStruct)#" index="i">
> 
> <cfoutput>MyStruct.#i#</cfoutput>&nbsp;=&nbsp;<cfoutput>#evaluate("MyStruct.
> #i#")#</cfoutput><br>
> </cfloop>
> 
> 
> PS I think that there is no function named StructFindNoCase(). There really
> is no need for it, because in ColdFusion, variable names are not
> CaseSensitive...
> 
> Chris Cortes
> Consultant
> [EMAIL PROTECTED]
> Direct 713-985-6244
> Cell 832-723-6485
> 
> Stonebridge Technologies
> ...The Fast Track to e-Business.
> vvisit us at www.sbti.com
> 
> 
> 
> ----- Original Message -----
> From: "Jon Tillman" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, September 08, 2000 10:31 PM
> Subject: Re: Setting structure values
> 
> 
> > On Fri, 08 Sep 2000, Chris Cortes spake thusly:
> > > <cfif StructFindNoCase(session.basket, FORM.productID)>
> > >
> > >     <cfset myStructure.key = "#MyNewValue#">
> > >
> > > </cfif>
> > >
> > > All you need to do is set the structure key to the new value.
> >
> > So to update the found record to the form record would go something like:
> >
> > <cfset #StructFindNoCase(session.basket, FORM.productID)# = #MyFormValue#>
> >
> > ??
> >
> > --
> > ***********************************************
> >  Jon Tillman
> >  LINUX USER: #141163
> >  ICQ: 4015362
> >  http://www.eruditum.org
> >  [EMAIL PROTECTED]
> > ***********************************************
> > Help Jon build a network!
> > Looking for giveaway computers & parts
> > Current Need: Tape Drive & PI/PII processors
> > Email me to find out how you can help
> > ***********************************************
> >
> > --------------------------------------------------------------------------
> ----
> > Archives: http://www.mail-archive.com/[email protected]/
> > To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
> >
> 
> 
> ------------------------------------------------------------------------------
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
>message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
-- 
***********************************************
 Jon Tillman
 LINUX USER: #141163
 ICQ: 4015362
 http://www.eruditum.org
 [EMAIL PROTECTED]
***********************************************
Be alert, the world needs more lerts
***********************************************

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to