Insert comma (,) between subtask in Calculated Text Field?
Say, my Calculated Text Field currently have this text expression (Advanced): toString(distinct(fieldValue(%{11267}, subtasks()))) + " --- " + toString(distinct(fieldValue(%{11132}, subtasks())))
- customfield_11267 is a multi-line text box.
- customfield_11132 is a multi select nFeed control.
Currently, the output just a long messy line. 1. Is there a way that I can insert comma between selection in subtask for multi select control? 2. Is there a way that I can even insert the line break as well?
Thx
Comments (13)
-
repo owner -
reporter Hi Fidel, I try and it doesn't make any difference. It doesn't insert the line break and even the comma between subtask. By the way, how do I insert the subtask key as well?
Thx
-
repo owner Hi @chaunguyen2007,
Try this:
toString(textOnIssueList(subtasks(), ^%{00015} + ": " + ^%{11267}), "\n") + "\n --- \n" + toString(textOnIssueList(subtasks(), ^%{00015} + ": " + ^%{11132}), "\n")
-
reporter The new syntax is improved where it inserts issue key and ':' for each subtask. However, the line break doesn't work at all.
-
repo owner Hi @chaunguyen2007,
Which field type are you using as target field?
Can you, please, attach a screenshot with the result you are obtaining from this string expression?
-
reporter -
repo owner Which field type is "Total System Affected (Rollup)"?
You can try another separator, like
;
. To do it use the following text expression:toString(textOnIssueList(subtasks(), ^%{00015} + ": " + ^%{11267}), "; ") + " --- " + toString(textOnIssueList(subtasks(), ^%{00015} + ": " + ^%{11132}), "; ")
-
reporter "Total System Affected (Rollup)" is the JWT Calculated Text field. If line break doesn't work, i guess we can separate out by using the ";".
-
reporter Hmm, now it's another mess. Say if the subtask fieds are empty w/o any value to rollup, the field displays a ton of subtask keys and ";"
-
repo owner Hi @chaunguyen2007,
Try the following text expression:
toString(textOnIssueList(filterByPredicate(subtasks(), ^%{11267} != null), ^%{00015} + ": " + ^%{11267}), "; ") + " --- " + toString(textOnIssueList(filterByPredicate(subtasks(), ^%{11132} != null), ^%{00015} + ": " + ^%{11132}), "; ")
-
reporter Almost there, it doesn't display the key for those empty subtask however, it doesn't display the ";" between the value in the subtasks.
-
repo owner Hi @chaunguyen2007,
Try the following text expression:
toString(textOnIssueList(subtasks(), ^%{00015} + ": " + ^%{11267}), "; ") + " --- " + toString(textOnIssueList(subtasks(), ^%{00015} + ": " + replaceAll(^%{11132}, "\\s+", ", ")), "; ")
Separation between different values of field customfield_11132 is done using
,
character, while separation between different subtasks is done using;
character. -
repo owner - changed status to resolved
I close the issue. Please, reopen it if it doesn't work as expected.
- Log in to comment
Hi @chaunguyen2007,
Try the following text expression: