Replies: 1 comment
-
This could both be done with variables and the slice variables block with the second issue being quite a bit more complicated but using the conditions blocks and making paths. The first you would assign your number or wherever you are pulling the number from a variable. Then using slice variable you would select what you want to keep or chop. So if it is always 4 digits before the decimal then you use Start Index at 4 with no End Index. If instead your numbers always end in .XX and you want to delete everything after the decimal you select End Index only at -3 (chops off the last 3 spaces). For the second you use slice variable in the first step to get your number (or not if you want to keep the digits after the decimal) and the run it through a conditions block like so: Then make paths for the variable ends in 5,6,7,8,9, then run it through an increase variable by either 5,4,3,2,1. That is if you want to round the last digit to the nearest value of 10. You would mess around with this formula until you get what you want. Might take a little while to setup but once made should be pretty concrete. Eventually you might have 10 or 20 paths depending on what you are rounding to but it should work. For example here this script grabs 55.23 and slices it to end with 55 then after it hits the condition block and increase variables block the variable's value is now 60. Hope this helps! It's just a start. There might be a more efficient way. |
Beta Was this translation helpful? Give feedback.
-
How do I round a numeric value?
the simplest
2056,78 — erase ,78 to leave 2056?
I tried using the Press Key block so that he presses Backspace, but for some reason he does not press it, besides, somehow it is necessary to ask him to press it twice or three times ...
What other options are there to automate the erasure of two numbers after the decimal point?
Let's complicate it.
I want the number to be rounded to a decimal point by a multiple of 5 or a multiple of 10, in order to adjust it to round down or up.
So that in the text field INSTEAD of the value 2056.78 (depending on the settings) I could get the edited value:
2056
2055
2050
2060
Beta Was this translation helpful? Give feedback.
All reactions