Add percntage to a variable

Hello all.

I have a process where i am getting the cost of a product into a variable (ItemCost) from a GET TEXT activity. Later in the process i need to have added 5% to that cost and output that new variable to the same app., but i can’t seem to find how to either +5% or x1.05. This variable is not from an excel document FYI

I tried Math.Round(((ItemCost)*1.05),2) and it did not like that. Also tried
Convert.ToDecimal((ItemCost.ToString)*1.05) and that failed too.

Any ideas how to get a percentage of a previous number?

Your help is much appreciated.

MikeB

Use: Convert.ToInt32(Number) and then * 1.05

First convert your value to numerical datatype than multiply but be aware about type conversion. Your second formula looks promising try to Convert.ToDecimal(ItemCost)*1.05D

Hey guys, thanks for the answers. Neither solution is working sorry.

The initial value is a currency number (eg 80.50), and is currently set as GenericValue in the variable pane.

I get the error “Assign : Cannot multiply a System.String with a System.Double”

Should i change the initial variable to something other than generic or?

Simple question, yet complicated to sort…Considering im using string splits & math round and excel table manipulation, you would think a simple % maths would be easy…but no :frowning:

Thanks

If its generic than use tostring first than use appropriate parse method i.e. decimal.parse

Issue resolved?
If not use following to add and convert output to string

(Convert.todouble(itemCost.tostring.trim) *1.05).tostring

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.