Bored... Went to BDO yesterday and too rooted to do any actual work, so had
a play with my CFMX/2k server

structetc() for anything except individual keys has always given me grief.
single key actions looped through the scope normally cleans it up for me
though. Appears to work

 <cfloop collection="#form#" item="formParam">
 <cfset request.Temp1 = structdelete(form, "#formParam#", true)>
 </cfloop>

seems to work for clearing form scope... Attached the test script I used
below. Let me know (gently! ;>) if I'm completely missing the point. Cause I
am truly fux0r'd right ATM (Foo fighters mosh, about 2 feet to the left of
Center Stage, 2nd row baby! Only had to shoot, stab or bludgeon a couple
hundred people to get there.)

------start snip 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";
</cfscript>

<!--- Produce a list so we can see whats going on. --->

 <CFSET request.temp = "">
 <cfloop collection="#form#" item="formParam">
 <cfset request.Temp =
ListAppend(request.temp,"#formParam#=#form[formParam]#")>
 </cfloop>

<!--- Loop through a struct delete --->

 <cfloop collection="#form#" item="formParam">
 <cfset request.Temp1 = structdelete(form, "#formParam#", true)>
 </cfloop>

<!--- Produce a list so we can see what's left in the struct --->

 <CFSET request.temp2 = "">
 <cfloop collection="#form#" item="formParam">
 <cfset request.Temp2 =
ListAppend(request.temp2,"#formParam#=#form[formParam]#")>
 </cfloop>

<!--- Print the lot --->

<cfoutput>
#request.temp#<BR>
#request.temp1#<BR>
#request.temp2#<BR>
</cfoutput>
-------end snip here------





"Scott Barnes" <[EMAIL PROTECTED]> wrote in message news:22056@cfaussie...
>
> that only deletes "keys" within a structure, i want to delete the actual
> base level structure itself
>
> Scott
>
> "sean" <[EMAIL PROTECTED]> wrote in message news:22055@cfaussie...
> >
> > From memory
> >
> > StructDelete(scope, "struct", true)
> >
> > should delete all records for that structure
> >
> > IE
> >
> > StructDelete(session, "usr", true)
> >
> >
> > "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