Thanks to all in advance - 

Question: How do I save the values of a struct in my Array vs a 'Link' to my 
Array?  This seems be saving a link to whatever is in memory regardless of if 
the data is told to update the array...
<cfset SESSION.MyCalcArray[SESSION.LZQuote.ThisItem] = "#SESSION.PCalc#">

My Problem:

I have a multi-page Pricing Calculator (4 page Form) where I am storing the 
FORM variables in a struct -works great- Then I want to be able to Save all 
those answers - The entire struct - as a Line Item in an Array - so the User 
can Add another Row. (very similar to a shopping cart...)

The Problem is that when I go back to restart my Struct to add a new line - it 
replaces the current values of the Struct that was saved in the Array... 
Instead of saving the NEW values as a new "row". So - if I erase the Struct - 
it also erases the values in my Array.... Or I will get 3 rows in my array with 
all  the same value - and if I add a new row - it makes them all the smae as 
the new one  - ?!?

CODE FOLLOWS:

The Main Struct is SESSION.PCalc - This holds all the user entered values as 
well as some database pulls

In Step One - I setup the basics:

<cfparam name="URL.ThisItem" default="1">
<cfparam name="SESSION.LZQuote.ThisQuoteNumber" default="">
<cfparam name="SESSION.LZQuote.ThisItem" default="URL.ThisItem">



<cfif Not IsDefined("SESSION.MyCalcArray")>
        <cfset SESSION.MyCalcArray = ArrayNew(1)>
    <h1>Array Was Not DEFINED!!!</h1>
</cfif>

<cfset variables.ThisQuoteNumber = "LZ-#RandRange(1000, 
9999)#-#RandRange(000001, 999999)#">
<!--- 

        Place Code That Checks if Quote Number is Unused

--->

<cfset SESSION.LZQuote.ThisQuoteNumber = variables.ThisQuoteNumber>
<cfset SESSION.LZQuote.ThisItem = URL.ThisItem>

<--- Clear Struct of OLD Variables --->
<cfif IsDefined("SESSION.PCalc")>
        <cfoutput>#StructClear(SESSION.PCalc)#</cfoutput>
</cfif>

<!-- Lots of Steps Here 2 thru 4  - assembling SESSION.PCalc--->

And at the End I Ask: Add Line Item - if so - go back to step one

<cfset SESSION.MyCalcArray[SESSION.LZQuote.ThisItem] = "#SESSION.PCalc#">

<cfset SESSION.LZQuote.ThisItem = SESSION.LZQuote.ThisItem + 1>

  <cfform 
action="Calc_Step_1.cfm?AddItem=TRUE&ThisItem=#SESSION.LZQuote.ThisItem#">
     <cfinput type="submit" name="submit" value="Add Line Item To Quote">
  </cfform>

Thoughts?  Help!

- Nick 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5312
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to