Converting string to float in NVelocity script

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
rjh
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Wed Oct 25, 2006 8:45 am

Converting string to float in NVelocity script

Post by rjh » Wed Mar 23, 2011 8:24 am

I am trying to modify our vendor email template to include some extra product template fields that are added to the product. I can access the field ok, but the value is a string. I need to do some calculations on this value and add it to the ExtendedPrice. If I use the value as is, nothing happens, most likely because I am trying to do calculations on a string. So ideally, the string needs to be converted to a float, or LSDecimal as the value is ".05".

I tried something like this:

#set($result=12345)
#set($result=$Float.Parse($found2).ToString())

Where $found2 = ".05"

Nothing happens when I do this, it simply prints the default value of $result.

Is there a way to convert a string to a decimal in NVelocity script?

Thanks.

Post Reply