Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

The value created in the lookup table cannot be calculated in the JQL condition of if

I want to calculate the value created in the lookup table in the JQL condition of if.
I would like to make the if condition calculated as follows, but is it not possible to calculate with the if JQL table?
{{#=}} {{done.get("A")}} - {{open.get("A")}} {{/}} > -1 and {{done.get("A")}} > 0

1 answer

0 votes
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.
Oct 06, 2023

Hi @koutarou ishibashi 

Your expression is both incorrectly using conditional logic and trying to combine that with a math expression in a way the rule cannot process.

Instead try using the inline version of those operations.  (I am assuming your lookup table values are text, and so have added asNumber for conversions.)

{{#if(and(done.get("A").asNumber.minus(open.get("A").asNumber).gt(-1), done.get("A").asNumber.gt(0)))}}do something{{/}}

As a tip...try building up logic like this piece by piece, writing the results to the audit log.  That will help confirm the expression works as you expect.

Kind regards,
Bill

Thank you for your answers and it is very helpful
When using custom fields, is it okay to describe it as follows?
Also, can the following description be used in the JQL conditions of the image?

{{#if(and(issue.customfield_10240.minus(issue.customfield_10240).gt(-1), issue.customfield_10240.asNumber.gt(0)))}}do something{{/}}

 

Don't worry about the language Japan of the image because it doesn't matterjql.png

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.
Oct 11, 2023

What is the type of your field customfield_10240: text, numeric, etc.?

That will impact the expression, such as if the asNumber conversion is needed.

the customfield_10240 type is a numeric

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.
Oct 12, 2023

In that case, you may remove the asNumber conversions.

Next, I notice you are trying to use that expression in a JQL action.  That will not work as it is not valid JQL.  What are you trying to test?

I want to refer to up to 18 numeric custom fields and conditionally determine the value of another field.
I want to do it 9 times

If you set them one by one, the maximum number of components per rule will exceed 65, so I want to describe them in one JQL.
Is it possible to describe the following in JQL?

(customfield_10240 - customfield_10241 > -1 and customfield_10241 = 0)
and ((customfield_10242 - customfield_10243 != 0) or (customfield_10242 =0 ))
and ((customfield_10244 - customfield_10245 != 0) or (customfield_10244 =0 ))
and ((customfield_10245 - customfield_10246 != 0) or (customfield_10245 =0 ))
...
..
.
Put statusA in issueA in the case of

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.
Oct 13, 2023

Okay, wow; that is a lot of fields to use in one decision, making me wonder about your use case.

Would you please describe the problem you are trying to solve?  And, describe an outline of the rule you are trying to do this?

Until we see those...

Please review the documentation link I provided for conditional logic.  You will want to use an advanced compare condition, and not a JQL condition, to test this.

I respectfully suggest breaking this expression up into pieces, storing them in created variables, and then combining them in the advanced compare condition.  That will make testing and maintenance much easier.  And, you would be able to do this in significantly fewer rule steps.

We are trying to do the following

I would like to determine the values of the fields "Z1" and "Z2" based on the values of the following fields: "A1," "A2," "B1," "B2," "C1," "C2," "D1," "D2," ... "I1," "I2."and "Z1," "Z2,"

Since everything is performed in order with "if:lssue Type is one of", automation ends as soon as the values of "Z1" and "Z2" are entered.


1.When "A1" is greater than 0 and "A2" is less than "A1," place 10*A2/A1 into "Z1" and "AAA" into "Z2."
2.When "A1" is greater than 0, and "A1" is equal to "A2," and "B1" is equal to "B2," and "B2" is equal to 0, and "C1" is equal to "C2," and "C2" is equal to 0, ...... "I1" is equal to "I2," and "I2" is equal to 0, then put 10 into "Z1" and "AAA" into "Z2."

3.When "B1" is greater than 0, and "B2" is less than "B1," and "B2" is greater than 0, then place 10*B2/B1+10 into "Z1" and "AAA" into "Z2."
4.When "B1" is greater than 0, and "B2" is equal to "B1," and "C1" is 0, and "D1" is 0, and..... "I1" is 0, then place 10*B2/B1+10 into "Z1" and "BBB" into "Z2."

 

5.When "C1" is greater than 0, and "C2" is less than "C1," and "C2" is greater than 0, then place 10*B2/B1+20 into "Z1" and "BBB" into "Z2."
6.When "C1" is greater than 0, and "C2" is equal to "C1," and "D1" is 0, and "E1" is 0, and ......."I1" is 0, then put 30 into "Z1" and "CCC" into "Z2."
...
18.When "I1" is greater than 0, and "I2" is less than "I1," place 10*I2/B1+80 into "Z1" and "HHH" into "Z2."
19.When "I1" is greater than 0, and "I2" is equal to "I1," then put 90 into "Z1" and "III" into "Z2."

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.
Oct 16, 2023

I am still unclear what problem this is solving, and I suspect this will be a brittle solution to implement in an automation rule...primarily due to the difficulty to maintain it.

Regardless, I continue with my earlier recommendation:

  • starting with A2 and A2, compute their conditional results and store them created variables. (Or a lookup table row; this sounds like a better approach as one action could save all 18 calculations, rather than 18 create variable actions.)
  • use those to set Z1 and Z2
  • test your rule
  • incrementally add B1 and B2 handling, and test
  • repeat until done successfully
  • stop, disable your rule, and copy it to a new rule
  • refactor to improve your rule, testing as you go along

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events