This stuff is driving me crazy!  All day spent to get almost nowhere...

Anyway...(deep breath)...

Quick question:  Does taking a number from a formfield and putting it into
a "session.cart.amount" variable automatically turn it into a string
variable?

I'm sending a number from a formfield and in testing the amount from the
formfield,
I can multiply it, format it using DollarFormat, etc... behaves like a
number should.

But once the formfield variable is placed in the Session Query as
session.cart.amount,
it behaves like a string...I can't use DollarFormat...it returns an error
that the variable session.cart.amount
has to be a number...if I use DollarFormat(Val(session.cart.amount)), the
value of the variable is 0...zero...
it becomes a valueless string...

I've haven't worked with the "session-type" queries created with
Session.Cart = QueryNew etc., before
and I guess I'm missing something...this should be simple stuff...but...

If anyone has any suggestions about why this is going on, I'd be grateful
for the help...

Rick


Excerpts from the code:

The formfield:

<SELECT Name="S4x6" Class="TextInput01">

     <Option Value="0" Selected>0</Option>
     <Option Value="1">1</Option>
     <Option Value="2">2</Option>
     <Option Value="3">3</Option>
     <Option Value="4">4</Option>
     <Option Value="5">5</Option>
     <Option Value="6">6</Option>
     <Option Value="7">7</Option>
     <Option Value="8">8</Option>
     <Option Value="9">9</Option>
     <Option Value="10">10</Option>

</SELECT>



Sent to another page for processing:



<CFLOCK Scope="Session" Type="Exclusive" TimeOut="5">

<CFSET Session.Total = 0>

<CFIF Form.S4x6 is not "0">

<CFSET Temp = QueryAddRow(Session.Cart)>
<CFSET Temp = QuerySetCell(Session.Cart, "PhotoFileName",
"<CFOUTPUT>#Form.PhotoFileName#</CFOUTPUT>")>
<CFSET Temp = QuerySetCell(Session.Cart, "Quantity",
"<CFOUTPUT>#Form.S4x6#</CFOUTPUT>")>
<CFSET Temp = QuerySetCell(Session.Cart, "Size", "4 x 6")>
<CFSET Temp = QuerySetCell(Session.Cart, "Amount",
"<CFOUTPUT>#Evaluate(Form.S4x6 * 3.95)#</CFOUTPUT>")>

<CFOUTPUT>#DollarFormat(Session.Cart.Amount)#</CFOUTPUT><br>


-----------------Note: CURRENTLY, ON THE LINE ABOVE, I GET THE FOLLOWING
ERROR:

Parameter 1 of function DollarFormat which is now "11.85" must be a number

I've tried using Val to create a number out of what must be a string, but
that will create a variable with a value of 0 (zero)...

----------------------------------------------------------------------------
-------------------------------------------------------

</CFIF>

<CFLOOP Query="Session.Cart">

     <CFOUTPUT>
          PhotoFileName: #PhotoFileName#
          Quantity: #Quantity#
          Size:  #Size#
          Amount:  #DollarFormat(Amount)#
     </CFOUTPUT>

  <CFOUTPUT>#DollarFormat(Amount)#</CFOUTPUT>

  <CFSET Session.Total = Evaluate(Session.Total+Session.Cart.Amount)>

</CFLOOP>
<br><br>

Order Total: <CFOUTPUT>#DollarFormat(Session.Cart.Amount)#</CFOUTPUT>

</CFLOCK>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137579
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to