# Concatenate 1.32B to 1.32 as an integer

Hi I am a bit new here and now on the recorder lessons. I was able to copy text from web recording. But I am trying to find a way to concatenate 1.32B to 1.32 only so I can get the average from another data that also have a ‘B’ at the end of the web data.

This is where I grab the web data.

I’m planning to assign data1 to td and data2 to td1 with the concatenated value so I can easily divide both.

any help would be greatly appreciated!

3 Likes

Hi @janlendl,

Welcome to UiPath Community,

Please try with this value in assign activity,

say,
Value = 1.32B
Value = Value.ToString.TrimEnd(CChar(“B”))

Cheers…!

Hi @Palaniyappan
should it not be after that Value2=Value.ToInt if he wants an Int val back?

1 Like

Your suggestion is correct buddy. If there is a need for int value to be used, we can have like as you say,
Value2 = Convert.ToInt32(Value)

Cheers…!

Does that approach works, else we can work on it.

Happy automation…!

@janlendl

1.32 is double value so converting it to double gives you a accurate result.

Use below expression for reference…

Convert.todouble(system.text.regularexpression.match(value,“\d+[.]{1}\d+”).value)

Or let me know, i will provide you sample workflow.

Cheers,

Something simple?

Writeline: Math.abs(Convert.ToInt32(123D)).ToString

You can try this with “val” function too
E.g: val(yourvariable).tostring

Thanks

Hi @Palaniyappan,
Thanks for your feedback. I’ve tried your suggestion and it seems it didn’t give me any error. I am now to the point of getting the average for both. I’m getting my footing again on using command expressions and I am trying to get my head around this now.

Just wanted to check as well, did I assign all my values with the correct variables?

Here’s my xaml file

Main.xaml (15.4 KB)

@CBlanchard, @sivapradeep, @rahatadi - I was able to capture 1.32B from recorder and assigned it as a genericvalue. My challenge was eliminating character “B” because it was included on the data.

@janlendl

Is this what you need?
(Convert.todouble(system.text.regularexpression.match(data1,“\d+[.]{1}\d+”).value)/Convert.todouble(system.text.regularexpression.match(data2,“\d+[.]{1}\d+”).value))

1 Like

Hi @janlendl,

You are doing good, Kind suggestion is remove the double quotes for data1 and data2 in the expression, because they are variables and not values.

Cheers…

I’m getting bunch of errors though.

Thanks y’all! I was able to make it work!!!. I guess my issue was data1 and data2 variables are set to genericvalue and since I am concatenating the value (Thanks to @Palaniyappan for helping me out with the correct syntax to use!) as string I need to change data1 and data2 variable as string and not genericvalue. And from there the convert to double ran perfectly fine! I’m now working on rounding off the output but I should be good to go.

Thanks again for all the inputs! I’m starting to enjoy this community because everybody is willing to help!

1 Like