Math.round not working

Hi Team
Can someone please advice what’s wrong with my script?

@CustomScriptAction(
)
 
 input = 'test2',   
    output = 'result'
    
def customScript() {
    def x = RNumber.of(test2)
   result = Math.round(x) / 100

}

You should use method roundDown or roundUp. You can see the details in our RPA API
https://workfusion-docs.s3.amazonaws.com/recorder/latest/index.html

Also, input and output need to be inside the parentheses.

@CustomScriptAction(
 input = ['test2'],   
    output = 'result'
)
    
def customScript() {
   result = test2.roundDown() / 100

}
1 Like

Thank @ashapkina

I wanted to round off the result to 2 decimal place in the script itself

i have search in the forum and i found this post

but the solution was not given

Please advice

The easiest way to do it is via 2 Number format actions.

You can convert a number to string and choose the format.

And then convert the string back to Number.

1 Like

thanks for the solution

1 Like