Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Errors on my automation calculation

Claas Babendererde
Contributor
May 30, 2023

We've got some numeric values, and I wanted to create a automation calculation to come up with a final "total score".

1st I set triggers (I think they are not so important here)

2nd I added smart-value-variable {{total score}} (does not know if that is actually necessary, since the field "total score" already exists)

3rd variable creation ("total score" field value).

{{#=}}{{issue.customfield_10091}}{{/}}{{issue.customfield_10090}}{{*}}{{issue.customfield_10081}}{{*}}{{issue.customfield_10092/100}}

Anyone got feedback to this calculation which leads to the error EINIGE FEHLER (some errors/non specified)?

2 answers

1 accepted

1 vote
Answer accepted
John Funk
Community Champion
May 30, 2023

Hi Claas,

Try this:

{{#=}}{{issue.customfield_10091}} / {{issue.customfield_10090}} * {{issue.customfield_10081}} * {{issue.customfield_10092}} /100{{/}}

If that's what you are trying to do. That will divide the first number by the second number THEN multiply that answer by the third number THEN multiply that answer by the fourth number. Finally, that answer will be divided by 100. 

I don't think that's what you want to happen, but maybe it is. 

Claas Babendererde
Contributor
May 30, 2023

@John Funk 
Unknown unary operator * at character position 14: 3.0 / 6.0 * * 1139.0 /100

I think that you always need to {{}} operators, at least this is what I learned from the automation resource board.

I tried to rephrase yours but
/100 {{/}}
as well as
{{/100}}
as well as
{{/100}}{{/}}

result in

Error when processing the template: Mismatched start/end tags: null != 100 in template-95e3eadf-682e-4895-a61f-8beaf8244d5d:1,

so I cannot even publish the automation.

I just need an idea now on how to dived the whole calculation by 100 and how to avoid 

"Could not convert the field value to a number. Please ensure that the value is a number, a mathematical expression or a smart value that can be converted to a number.
Total Score: 1362.037.51736.0
No fields or field values to edit tasks (possibly due to field values not being present in a particular project):"
(See post below answering @Valerie Knapp )

John Funk
Community Champion
May 30, 2023

What exactly are you trying to calculate? 

Claas Babendererde
Contributor
May 30, 2023

@John Funk 

(Votes/Views) * ((TotalMRR*(FoxlyScore/100))

Trudy Claspill
Community Champion
May 30, 2023

Hello @Claas Babendererde 

You should not be putting your mathematical operators in curly braces {{ }}. See the documentation here:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

Looking at the statement provided by John:

{{#=}}{{issue.customfield_10091}} / {{issue.customfield_10090}} * {{issue.customfield_10081}} * {{issue.customfield_10092}} /100{{/}}

...and comparing that to your error message:

Unknown unary operator * at character position 14: 3.0 / 6.0 * * 1139.0 /100

Notice that you have two "*" next to each other in the error message. That means that field {{issue.customfield_10081}} has no value. That is the cause of the error.

Value from error  associated field from formula 
3.0   issue.customfield_10091
 6.0  issue.customfield_10090
   issue.customfield_10081
 1139.0 issue.customfield_10092
Like # people like this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2023

Hi @Claas Babendererde 

Adding to what the others have suggested...

When one of your fields could be empty, what do you want to happen?  If there is a default value to use, that can be supplied with the pipe | operator.

For example, let's assume you want your custom field to default to 1 when it is empty:

{{issue.customfield_10081|1}}

Kind regards,
Bill

Like # people like this
Claas Babendererde
Contributor
May 31, 2023

OK, that was all very helpful. 
I also got an error when applying @John Funk solution meaning leaving out curly brackets.
Thx @Bill Sheboy this comment was too helpful, this was exactly my next question. Thx so much :)

Like Bill Sheboy likes this
John Funk
Community Champion
May 31, 2023

Based on your feedback above, give this a try:

{{#=}}({{issue.customfield_10091|0}} / {{issue.customfield_10090|0}}) * (({{issue.customfield_10081|0}} * ({{issue.customfield_10092|0}} /100)){{/}}

This includes your groupings and setting each field to 0 if there is no value. If you want the value to be 1 instead of 0 if it is missing, then simply change that value in the formula. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2023

And also...There are at least two ways to perform math operations with rules: math expression and chained/inline.  Knowing both can help in different circumstances.

The math expression you have already used.  This can help when you want the expression more human-readable or when there is conditional logic.

The chained/inline one literally describes the operation, and you need to think about how to do them, in left-to-right processing.  I believe your example could be this:

{{issue.customfield_10091.divide(issue.customfield_10090).multiply(issue.customfield_10081).multiply(issue.customfield_10092).divide(100)}}

Like John Funk likes this
Claas Babendererde
Contributor
May 31, 2023

Guys @Bill Sheboy @John Funk @Trudy Claspill @Valerie Knapp it finally worked with your suggestions.
Thank you all!

Like # people like this
Valerie Knapp
Community Champion
May 31, 2023

Happy for you @Claas Babendererde

Like John Funk likes this
John Funk
Community Champion
May 31, 2023

Yes, very happy.  :-)

Like Valerie Knapp likes this
0 votes
Valerie Knapp
Community Champion
May 30, 2023

Hi @Claas Babendererde , thanks for your question.

If you aren't getting a clear reason for why the automation isn't working, I typically also add an action putting the same calculation into the audit log -

image.png

You could also put different variations of the calculation in here, to see how far you get before it fails for example.

{{#=}}{{issue.customfield_10091}}{{/}}{{issue.customfield_10090}}{{*}}{{issue.customfield_10081}}{{*}}{{issue.customfield_10092/100}}

Like 

{{#=}}{{issue.customfield_10091}}

 

{{#=}}{{issue.customfield_10091}}{{/}}{{issue.customfield_10090}}

 

{{#=}}{{issue.customfield_10091}}{{/}}{{issue.customfield_10090}}{{*}}{{issue.customfield_10081}}

 

and so on. Have you already tried something like this? What was the result?

Claas Babendererde
Contributor
May 30, 2023

Thx so much for your suggestion.

I did not get the reporter thing working nor did I understand how it could help me. But I tried to ease the calculation.

You need at least {{#=}}{{issue.customfield_10091}}{{/}}{{issue.customfield_10090}}

It works! 

 

Adding

{{#=}}{{issue.customfield_10091}}{{/}}{{issue.customfield_10090}}{{*}}{{issue.customfield_10081}}

It works!

 

Hence the issue is the expression {{issue.customfield_10092/100}}


What I wanted to do:

(A/B*C)*(D/100)

 

I replaced to

{{#=}}{{issue.customfield_10091}}{{/}}{{issue.customfield_10090}}{{*}}{{issue.customfield_10081}}{{*}}{{issue.customfield_10092}}

(left out division by 100) and it works.

 

Still I get a error code (translated by deepl)

Edit operation
Could not convert the field value to a number. Please ensure that the value is a number, a mathematical expression or a smart value that can be converted to a number.
Total Score: 1362.037.51736.0
No fields or field values to edit tasks (possibly due to field values not being present in a particular project):

This is astonishing, since there are only complete numeric values except mrr, which can be like 1240.24 (always two values post .)


Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events