Addition of two values

Hi All,

I am working in a scenario where I have to add two values say (8.73 & 0.25). I am using assign activity to store the sum of these two numbers in another variable. I have set the data type for all of them as “Generic Value”. Then I am using the type into activity for typing the final sum into a text box present on a web page. But the typed value is coming as “8.730.25” rather than the sum. What should be done as this is not the desired result ?

Thanks for reading !

Hi @Piyush_Hemant,

Might be better to change the data type to Int if you know it’s gonna be integer.

I guess you assigned your values as below?

Assign a = “8.73”
Assign b = “0.25”

Since it’s Generic Value, so it can be string, integer or other type, so if you put " " around your assigned value, it make it become string, just remove " ".
e.g. Assign a = 8.73

Then when you do a+b you will get 8.98
image
image

Hope this helps.

Cheers

Allen

Hi Allen,

Thanks for responding quickly. I just wanted to know that if 8.73 can be accommodated in a variable having data type as Int32 ?

Also I have attached the workflow please see and tell me the changes to be done in assign activity because I haven’t used “” there.

Thanks :slight_smile:

Hi,

Perhaps you should use variable t as not GenericValue but specific type(Int32 or String).

If type of t is Int32, Value property of Assign Activity will be the following.
CInt(a)+0.25
or
CInt(a.toString.Trim)+0.25 (In case of containing white spaces)

Then the Text Property of TypeInto Activity will be t.toString

Regards,