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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.