Create a Calculated field to split up a another field based on labels

I am creating a report that shows Features in the Active Sprint and the Row information is the Responsibilities field (LoV field). There are 6 values available in the Responsibilities field, one of the values being software. My current report is per below.

I would like to break down the Software Column into 3 Columns based on Label values of the Feature.
For each Feature, something like:

CASE
WHEN Responsibilities = “ATE” THEN “ATE”
WHEN Responsibilities = “Electrical” THEN “Electrical”
WHEN Responsibilities = “Software” AND Labels = DSR THEN Responsibilities = “Software-DSR”
WHEN Responsibilities = “Software” AND Labels = LCT THEN Responsibilities = “Software-LCT”

etc…

ELSE
END

So instead of 6 columns, I would have 8.
ATE | Electrical | Firmware | Software (label = DSR) | Software (label = LCT) | Software (label = LCT5) | Test Engineering

I assume that this would need to be a “new calculated field” created in the Data Source definition but am not sure how to write the code.

We were able to resolve with some web searching, cut and paste and trial and error.:

if (issue.fields.customfield_13610) {
var resp = issue.fields.customfield_13610.value
var labs = issue.fields.labels
if (resp === “ATE”) {
return resp;
} else if (resp === “Test Engineering”) {
return resp;
} else if (resp === “Firmware”) {
return resp;
} else if (resp === “Electrical”) {
return resp;
} else if (resp === “Systems”) {
return resp;
} else if (resp === “Software”) {
for (var i = 0; i < labs.length; i++) {
var lab = labs[i];
if (lab === “LCT_Legacy”) {
var resp = “Software_LCT”;
} else if (lab === “LCT5”) {
var resp = “Software_LCT5”;
} else if (lab === “DSR”) {
var resp = “Software_DSR”;
}
}
return resp;
}
}

1 Like