 # Calculater robot

Hello i have a robot that reads two kinds of invoices. The thing its that the first invoice has 575, 75 and the other has 576, 00
Its been round up, but its still correct. I want something that calculates this behavior so if the number its 50 or higher after the " , " then round it up else round it down.

You can try using Math.Round(cDbl(yourvalue),MidpointRounding.AwayFromZero).ToString
Assuming that yourvalue is of type string.
See more on this here :

tried it but the number i have its 575, 75 and its not valid for int32 it says

Try to replace “,” with “.” and remove the white space after “,” so 575, 75 should become 575.75

Managed to turn it into 575.75 but its currently a string, how can i turn it into a int32 or double/float if thats correct

cDbl(yourvalue) does that.

what you mean ? shall i use assign ?

Did not work, when the number its 575.00 its still rounds the number so now its 574.75

Want it to only round the number if its has something in the decimal like 650.25 = 650.00
753.75 = 754.00 etc

Convert.xaml (5.9 KB)

Ok thanks that kind of works. but now they both are strings. i also need a if statement to check whenever the numbers its the same, are different with less than 2

hi
first use a if condition like this
dblvalue1 = IF(Cint(Split((“575, 75”).ToString.Replace(", “,”."),".")(1))>50, Math.Round(Cdbl(“575, 75”).ToString.Replace(", “,”."))), cdbl((“575, 75”).ToString.Replace(", “,”.")))

dblvalue2 = IF(Cint(Split((“575, 00”).ToString.Replace(", “,”."),".")(1))>50, Math.Round(Cdbl(“575, 00”).ToString.Replace(", “,”."))), cdbl((“575, 00”).ToString.Replace(", “,”.")))

where both dblvalue1 and dblvalue2 are of type doule defined in the variable panel

then in a if condition mention as
dblvalue1.equals(dblvalue2) OR (dblvalue1-dblvalue2)<2

if true it will go to then part or to else part
Cheers @langsem

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