How to convert String to Decimal ... to string again

Hi to all,
I have a problem managing the multiple conversion of a value, to convert to decimal, keeping the (.) decimal and the 2 decimal places, even if they are = 00

I’m working on a flow where, I collect data from a CSV and need to create an XML.
I currently have a Read CSV and then an Import on DB.
The ‘ammout’ value on DB is set as Decimal, with two decimals.

The value on the CSV is integer.
ex: 80000 , I need to get this value: 800.00 as a string,
to paste into the final XML.

Can anyone help me in this mission impossible for me!
thanks
Aaron

Hi @AaronMark

So can you send me your dummy excel file so that I can take a look and give you a working solution.

If you just have to update column level values
Math.Round(CDbl(CurrentRow(“Amount”).toString),2)

or CDbl(CurrentRow(“Amount”).toString).ToString(“F2”)

This should work!

@AaronMark

First of all how do you know 80000 is 800.00

Cheers

INPUT_CSV.csv.xls (302 Byte)

This is a CSV I may receive to convert.
Even if it only contains one line.
I need to create an XLM starting from this CSV.
The BOT is already fully realized, but they told me only today that the amounts will have to be converted into decimals, as I indicated above.
the final XML must have the sum of all the amounts, (column I) in decimal.
and subsequently, in the rest of the body, the amounts of the individual lines, converted into decimals.
The decimal requires the two digits after the decimal point.

My bot starts with a Read CSV, and immediately after, an Inport DT to database.
Where the Amount field was expressed in Varchar, and now in decimal.
In any case, I can’t handle this conversion properly.

Because these are the agreements with the supplier,
which produces the csv.

Hi @AaronMark

Please take a look at the following.
This should help

CSV Data.xaml (9.3 KB)
i

If this conversion doesn’t work, you need to send the data one by one. and use

CDbl(CurrentRow(“Amount”).toString).ToString(“F2”) while inserting data into query.

Thanks

@AaronMark

So if it is 8 will the value be 0.08?

Cheers

They are annual fees, so I assume the figure is always higher than hundreds.
but… according to the logic they gave me, yes.
8 = 0.08

grafik

I don’t know why, but it gives me an error.
“F2” is not recognized as a command. (I believe)
I’m looking for alternative solutions… I’ll try to manipulate the value upstream, directly via DB with Queries.

Hi @AaronMark

Hope this one Helps you

number = (CDbl(MyNumber)/100).ToString(“0.00”)

ensure that double quotes are of type: " and not the inverted one

kindly note: screenshots were done within the UiPath immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

About the docu have a look here:


Where F2 is coming from