How do multiplication for 2 string with 3 decimal and 2 decimal place

I am trying to multiply a string with 2 decimal and another with 3 decimal
say 2.75 time 0.752

I tried writing
convert.ToDouble(row.item(“Discount Percentage”))*convert.ToDouble(row.item(“List Price”))

it comments on wrong string format.

how do i solve this?

best regards
Peter Mak

cdbl(row.item("Discount Percentage").tostring)*cdbl(row.item("List Price").tostring)

image

Hi,

Can you check if there is a blank in your datatable (or sheet)?

Regards,

I see a problem. how do i change the 2.743,00 to 2,753.00? in my excel spread sheet ?

Hi,

Can you try the following expression?

Double.Parse(row.item("Discount Percentage").ToString, New System.Globalization.CultureInfo("es-ES"))*Double.Parse(row.item("List Price").ToString,New System.Globalization.CultureInfo("es-ES"))

Regards,

Hi Yoichi

thanks … it work
but the result is not correct
2.753,00 time 0.752 now become 2070256

i think the list price is from Europe format
how do change the . to , and , to .

any idea ?

best regards
Peter Mak

Hi,

In my environment, it’s right value in UiPath.

img20210907-A

Is the above value from Excel?

If so, can yo try the following expression?

strResult = dblResult.ToString.Replace(".",",")

Then write strResult to excel.

Regards,

HI Youchi

I manage to change all the , to . in the Excel itself.
but the code behave 2753 x 752 instead of 0.752?

best regards
Peter Mak

Hi,

but the code behave 2753 x 752 instead of 0.752?

It seems . is recognized as thousand separator.

If possible, can you share your xaml and xlsx file?

Regards,

sure this is only for my practice

however the price list has been changed

BOM sample 1.xlsx (18.2 KB)
Auto Costing.xaml (14.9 KB)

hope you can help

Hi,

Thank you for sharing. However, I try to ran the workflow, it failed due to Part No. in Sheet1 does not exist in Sheet2.
Can you share data which i can run as it is?

Regards,

Hi YoiChi
sorry for the delay
the data are real so i cannot send out
I fabricate new data sheet and new sequence

now i am stuck at turning “Discount Percentage” to “discount factor” just by divide by 100
the error message i receive is object cannot be cast from DBNull to other types
I am using the same formula as before, i wonder what went wrong
can you advise

Next I will be need to multiply the “discount factor " to “List Price” and QTY to get my “” Total Price”

Can you advise

Auto Costing 2.xaml (13.7 KB)
BOM sample 1.xlsx (17.4 KB)

Hi,

It’s because Part No of row No.23 or above is blank. (in Main sheet)
If you can delete row No.23 or above, can you try FilterDataTable activity with remove PartNo “is Empty” just before ForEachRow?

Regards,

Thank you so much
everything work now :laughing:

1 Like