Yeah but be careful with StructClear()

ie

<cfscript>
// Waypoint 1
newStruct = StructNew();
newStruct.key1 = "blah"
newStruct.key2 = "blah";
myobject.writeToDb(newStruct);
// Waypoint  2
StructClear(newStruct);
newStruct = StructNew();
newStruct.key1 = "blah2"
newStruct.key2 = "blah2";
myobject.writeToDb(newStruct);
// Waypoint 3
StructClear(newStruct);
newStruct = StructNew();
newStruct.key1 = "blah3"
newStruct.key2 = "blah3";
myobject.writeToDb(newStruct);
</cfscript>

Looking at that, you would assume waypoints 1,2 would commit that
information to the database or whatever, and then reset that structure so
you can re-use its "name" in say a loop or whatever your desire.

Only, it would basically clear it each time and you would always end up with
a emtpy structure, even though the request to clear it was after its
initated the myobject.writeToDb

Furthere more, use that above and remove the StructNew() statements and it
does what i was saying before, makes waypoints 1 and 2 the same as waypoint
3 even though waypoint 3 comes after 1 and 2 :)

Freaky shit eh

Scott


"Tim McAuliffe" <[EMAIL PROTECTED]> wrote in message
news:22060@cfaussie...
>
> GDay Scott,
>
> <cfset tmp = StructClear(form)>
>
> or (better IMO)
>
> <cfscript>
> StructClear(form);
> </cfscript>
>
> Will clear the structure. The structure name 'form' is reserved and will
> always be defined.
>
> HTH
>
> Tim
>
>
> "Scott Barnes" <[EMAIL PROTECTED]> wrote in message
news:22052@cfaussie...
> >
> > How do i reset a structure completely for re-use?
> >
> > Basically what happens is the last form.structure build resets all
> > "Previous" structures to its value? when in fact i just want it to have
> each
> > of its own instance.. ie like a tmp variable in a loop if you will.
> >
> > Scott.
> >
> > --- Code here --
> > <cfscript>
> >
> >  // Emulate the Form
> >  form     = StructNew();
> >  form.ItemID   = "22";
> >  form.Qty   = "10";
> >  form.ChckInDate   = "14/12/2002";
> >  form.Duration    = "3";
> >  form.Price   = "$300.00";
> >  form.Inclusions  = "blah";
> >  form.NoTraveling = "1";
> >  form.Notes   = "blash";
> >  form.Rooms   = "2";
> >  form.TravelNames = "Agnus, Delila";
> >
> >  // Define the Objects Instance
> >  theCart = createObject("component","comp.shopcart.cart");
> >  theCart.Add(form);
> >
> >
> >  StructClear(form);
> >  form     =  StructNew();
> >  form.ItemID   = "12";
> >  form.Qty   = "1";
> >  form.Price   = "$600.00";
> >  form.Inclusions  = "blah";
> >  form.NoTraveling = "1";
> >  form.Notes   = "blash";
> >  form.TravelNames = "Agnus, Delila2";
> >
> >  theCart.Add(form);
> > </cfscript>
> >
> > <cfdump var="#theCart#">
> >
> >
> > --
> > Freelance Application Developer / Designer
> > --
> > ph: 07 3288 6702
> > mob: 04040 32812
> > --
> > url: http://www.spidaweb.com
> >
> >
> >
> >
> >
>
>
>
>



---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to