Unary Error when calculating total sum

Orla Mears
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 17, 2024

Hi team,

I have set up an automation rule which has various calculations depending on which option is selected in 4 drop-down fields. I have checked these meticulously for any potential errors (spacing/grammar) and all look fine.

The final rule I've added is like this:  {{#=}}{{scoreExample1}}*{{scoreExample2}}*{{scoreExample3}}*{{scoreExample4}}{{/}}

 

I keep receiving the following error 

Error rendering smart-values when executing this rule:
Unknown unary operator * at character position 5: 1*1**1

I've checked everything and I cannot see what the issue might be! Any help much appreciated

1 answer

0 votes
Gonçalo MB _WDIScan_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 17, 2024

Hi. I'm not an automation expert, but I think the issue is related to an empty value on one of the fields.

The error message kind of points to the problem. On your example you are trying to multiply 4 fields, but the third one is empty, that creates the expression 1*1**1, which is invalid because it has two * side-by-side and that's not a valid operator.

You can fix it by adding default values to your smart values, e.g.:

{{#=}}{{scoreExample1|1}}*{{scoreExample2|1}}*{{scoreExample3|1}}*{{scoreExample4|1}}{{/}}

Notice the '|1' after each field name, that sets the default as 1, change accordingly.

I would also change it to include the 'issue.' prefix. It may not be necessary, but in my mind is a bit more descriptive and avoids other name collisions.

{{#=}}{{issue.scoreExample1|1}}*{{issue.scoreExample2|1}}*{{issue.scoreExample3|1}}*{{issue.scoreExample4|1}}{{/}} 

See also, "default values" on the documentation:

https://confluence.atlassian.com/automation/smart-values-syntax-and-formatting-1141480622.html

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events