Hi,
I have two variables tax and total I want to get sum of these two variables and type into the output to a web page.
tax= 0,03 and total= 2.201,39 in web page number format is like this.
1-When I use format value I get "Cannot convert generic value to system.decimal error message.
2-Also I am getting output for tax as 3.00 in format value activity.
How can I solve this problem?
Thank you.
Hello,
I prefer to use simple assign activities in this type of case.
for assigning decimal variable use ‘d’ at the end:
decimalVariable = 23.03d
for convering to decimal use (for instance from double and string):
Convert.ToDecimal(23.03)
Convert.ToDecimal("23.03")
to convert from decimal to string (we can use it in type into activities):
decimalVariable.ToString
Hi @makboga ,
Could you also let us know what should be the sum of these values according to you which needs to be input in the web page ?
Hi,
sum of two variables should be 2.201,42 format.
You can try French or German format
Convertion to decimal:
Convert.ToDecimal("2.201,39".replace(".",""),System.Globalization.CultureInfo.GetCultureInfo("fr-fr").NumberFormat)
Convertion to string:
decimalVariable.ToString("#,##0.##########",System.Globalization.CultureInfo.GetCultureInfo("fr-fr").NumberFormat).replace(" ",".")
Be careful - there is ‘non-breaking’ space in second expression
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.