Function that changes a decimal when selecting an enumeration

Hello, I have a decimal attribute and an enumeration one. I want the decimal to change to negative number when I select one of the enumerations, and positive to the other. Is there a way to do it other than with validations and the user to write – or +?   Thanks
1 answers

Not completely sure what your case is, but you could add an onchange microflow to the enum that the user selects and then add a decision in the microflow like $object/enumattribute = positive if true change the decimal like this

if $object/decimalattribute < 0 then $object/decimalattribute *-1 else $object/decimalattribute

when the result is false from the decision changethe value as:

if $object/decimalattribute > 0 then $object/decimalattribute *-1 else $object/decimalattribute

Maybe this helps in your case.