Insert comma (,) between subtask in Calculated Text Field?

Issue #851 resolved
Chau created an issue

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)

  1. Fidel Castro Armario repo owner

    Hi @chaunguyen2007,

    Try the following text expression:

    toString(distinct(textOnIssueList(subtasks(), ^%{11267})), "\n") + " --- " + toString(distinct(textOnIssueList(subtasks(), ^%{11132})), "\n")
    
  2. Chau 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

  3. Fidel Castro Armario repo owner

    Hi @chaunguyen2007,

    Try this:

    toString(textOnIssueList(subtasks(), ^%{00015} + ": " + ^%{11267}), "\n") + "\n --- \n" + toString(textOnIssueList(subtasks(), ^%{00015} + ": " + ^%{11132}), "\n")
    
  4. Chau reporter

    The new syntax is improved where it inserts issue key and ':' for each subtask. However, the line break doesn't work at all.

  5. Fidel Castro Armario 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?

  6. Fidel Castro Armario 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}), "; ")
    
  7. Chau 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 ";".

  8. Chau 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 ";"

  9. Fidel Castro Armario 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}), "; ")
    
  10. Chau reporter

    Almost there, it doesn't display the key for those empty subsupport1.pngtask however, it doesn't display the ";" between the value in the subtasks.

  11. Fidel Castro Armario 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.

  12. Log in to comment