|
Hi
I am using the following code to try and convert the result of a split to an integer in order to add the values together to give a running balance.
The split code
details=Request.Cookies("cart_contents")
Response.Write("details:<br>"&details&"<p>")
detail_split=Split(details,"<br>")
detail_count=Ubound(detail_split)
Response.Write("detail_count="&detail_count&"<br>" )
detail_lbound=Lbound(detail_split)
Response.Write("detail_lbound="&detail_lbound&"<br >")
FOR count=1 TO detail_count-1
product_name=Split(detail_split(count),"£")
product_tmp=product_name(1)
product_pricetmp=Split(product_tmp,"Q")
product_price=product_pricetmp(0)
product_qty=product_pricetmp(1)
Response.Write("<p>count="&count&"<br>")
Response.Write("product_name="&product_name(0)&"<b r>")
Response.Write("product_tmp="&product_tmp&"<br>")
Response.Write("product_pricetmp="&product_pricetm p(0)&"<br>")
Response.Write("product_price="&product_price&"<br >")
Response.Write("product_qty=QTY "&product_qty &"<p>")
The for the display
Response.Write(product_price&"<br>")
price=product_price
IF IsNumeric(price) THEN
price_temp=CInt(price)
Response.Write("price_temp"&price_temp&"<br>")
ELSE
Response.Write("xnumeric<br>")
END IF
IF IsNumeric(product_qty) THEN
price_qty=CInt(product_qty)
Response.Write("price_qty"&price_qty&"<br>")
ELSE
Response.Write("xnumeric")
END IF
price=price_tmp*price_qty
Response.Write("£"&price&"<br>")
The output shown that price is a non numeric value and as a result will not convert it to an integer but there is no problem with price_qty.
The values returned are
count=1
product_name=(L200-030 HFEF) 3.00 kW 7.80 AMP 3ph
product_tmp=484 Q1
product_pricetmp=484
product_price=484
product_qty=QTY 1
This has been driving me nuts.
Thanks in advance
Alun
|