I am trying to create a Rule that calculates the difference between the Number value of 2 fields, and have this difference set in a new field. We need to have this value as Positive - basically have the Absolute value.
It looks something like this:
rule "Check Diff" when has_field("FieldName") then let Value1 = $message.Field1; let Value2 = $message.Field2; let Diff = Value1 - Value2; set_field("TotalDiff", Diff); end
In this case, if Field2 is larger than Field1, the Diff value with be negative.
I tried using the | symbol ( |Value| ), on the Parameter value in SET row, but it shows error.
I could not test this, so not sure if what I wrote is even correct
Would appreciate any assistance.
Let me know if you need additional info.