we have 8 priority-style labels (A-1
= highest, H-8
= lowest) or (H-8, G-7, F-6, E-5, D-4, C-3, B-2, A-1 )tagged with JIRA issues
If an issue has multiple labels, we want Structure formula to compare them and display the **highest-priority one (A-1 > … > H-8)*.
If an issue has ["C-3", "F-6"]
→ formula returns 3
(C-3).
If it has ["B-2", "E-5", "H-8"]
→ formula returns 2
(B-2).
I am loading all issues in JIRA structure and created below formula
WITH priorityOrder = {
"A-1": 1,
"B-2": 2,
"C-3": 3,
"D-4": 4,
"E-5": 5,
"F-6": 6,
"G-7": 7,
"H-8": 8
};
WITH best = MIN(FOR l IN LABELS: priorityOrder[l]);
FIRST(FOR l IN LABELS: IF priorityOrder[l] = best: l)
it is not working do we have any solution for the same
Hey @Abhinav Singhal, I believe you are close! The main issue is WITH scoping: in Structure’s Expr language, a WITH … : <expression> only defines the variable for the expression that follows the colon, so you can’t define priorityOrder on one line and then use it in a completely separate expression. You need to nest the WITH blocks (or keep everything inside the first WITH). Also, it’s a good idea to guard against labels that don’t match your A‑1…H‑8 list (or issues with no labels) using DEFAULT(...) / IFERR(...).
Check the links below
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Abhinav Singhal
The syntax of the formula is incorrect:
- WITH statements should be like: WITH variable_name = ... :
- if you want to define different values based on the existing values, you might try using the CASE() function: case(labels, "A-1", 1, "B-2", 2,..., 999)
- if you want to check the priorities of sub-issues, you need to use the aggregate function MIN{}
I hope this helps. If you have Jira Data Center or Jira Cloud, please reach out to us directly at our support portal if you have any other questions about Structure.
Best regards,
Stepan
Tempo (the Structure app vendor)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.