Division in UiPath / VB.net


#1

I want to have a simple division formula with round integer result like “7 / 2 = 3”, and according to this article, it seems like we have to do it in “7 \ 2” in VB.

But this happens when I perform UiPath (and in Windows Explorer and some other apps) that when I type ‘’ it becomes ‘¥’ (I think it’s because I’m having the PC set in Japanese setting, all the folder path is becoming like “C:¥Users¥Administrators¥Desktop”. Any workaround to this?


#2

Hello @whyyouandi just set your formula to clipboard with Set to Clipboard activity and pass hotkey Cntrl + v to paste your formula in desired fields. It is working for me.


#3

You can use 7/2, rather than 7\2. Or you can use Decimal.Divide.

See attached.
division.xaml (6.6 KB)


#4

Thank you @AkshaySandhu, sorry for the incomplete explanation.
I wanted to enter the formula into the Assign activity in UiPath (sweat).


#5

Thank you @a-taniya, but I was looking for an integer for the result.
This below works but wondering if there is more straightforward way to do this.

Math.Round(Decimal.Divide(1/10))


#6

How about Math.Round(1/10) ? I think it should work.

=edited=
Sorry I misunderstood your question.
In my case, backslash works perfect; 101\10 returnes 10.
I’m Japanese and of course my PC set in Japanese setting, so I guess there’s mistake on your flow.
Would it be possible to attach your workflow or screenshot?


#7

Hi @whyyouandi,

If you cann’t use \ operator, try to use Math.Truncate method.
https://msdn.microsoft.com/es-es/library/system.math.truncate(v=vs.110).aspx

Regards,
Susana


#8

Thank you @a-taniya, when I tried it in another PC, the operation still showed as “1¥10” when I typed “1\10” but it worked fine with no error, can’t comprehend why, but it just worked.


#9

Thank you @Susana, was looking for a simpler workaround :wink: