Hi All,
We have an automation that we wrote which is having some issues and I am looking at how to fix it.
The automation triggers on any of three custom fields changing, does a math calculation on them and sets a fourth field with the value as it goes through the inputs. But we are getting bad results when a user changes the thee input params in quick succession (which is common)
Currently it is something like this:
When A, B or C changes
Set D = 1
IF A = high { D = 5}
Else if A = Med {D = 3}
re-sync
IF B = High {D = D*5}
Else if B = Med {D = D*3}
re-sync
IF C = High {D = D*5}
Else if C = Med {D = D*3}
So our idea is to create a smart variable and set its value as we do the calculation(s) then at the end set "D" to the smart variable's value.
Like this:
When A, B or C changes
create {{DVar}} = 1
IF A = high { DVar= 5}
Else if A = Med {DVar= 3}
re-sync
IF B = High {DVar= DVar*5}
Else if B = Med {DVar= DVar*3}
re-sync
IF C = High {DVar= DVar*5}
Else if C = Med {DVar= DVar*3}
set D = {{DVar}}
I can create the smart variable, and I can set the field to the smart variable, but for the life of me I can't figure out how to update the smart variable value.
Essentially we are looking to mutex the calculations so parallel automations won't result in bad results.
Any suggestions or input is much appreciated