Generating Table from Issue-Key-List

Issue #559 resolved
Patrick Schuh [brainbits] created an issue

Hi Fidel,

I have a list of issues keys (key-1, key-2, key 3) and I'm woundering if its possible to transform this into a issue table using the copy parsed text to field function:

||Key||Summary|| |key-1|Summary 1| |key-2|Summary 2| |key-3|Summary 3|

Thank you Patrick

Comments (12)

  1. Patrick Schuh [brainbits] reporter

    I want to use it to write a comment that is shown in the customer portal of Service Desk. Therefore it needs to be WIKI-Markup

  2. Fidel Castro Armario repo owner

    This expression composes a table in wiki format containing linked issues:

    "||Issue Key||Summary||\n" + toString(textOnIssueList(linkedIssues(), "|" + ^%{00015} + "|" + ^%{00000} + "|"), "\n")
    

    replacing linkedIssues() with your issue list expression.

    Note that %{00015} is field code for Issue key, and %{00000} is field code for Summary.

  3. Patrick Schuh [brainbits] reporter

    I store my list of issue keys in an ephemeral text field. So I tried the following but an parsing error is returnd:

    "||Issue Key||Summary||\n" + toString(textOnIssueList(%{00061}, "|" + ^%{00015} + "|" + ^%{00000} + "|"), "\n\n")

    Using this results in an empty list: "||Issue Key||Summary||\n" + toString(textOnIssueList(likedIssues(%{00061}), "|" + ^%{00015} + "|" + ^%{00000} + "|"), "\n\n")

  4. Fidel Castro Armario repo owner

    Use this expression:

    "||Issue Key||Summary||" + toString(textOnIssueList(issueKeysToIssueList(%{00061}), "\n|" + ^%{00015} + "|" + ^%{00000} + "|"), "")
    
  5. Patrick Schuh [brainbits] reporter

    Works perfect: one last question o that topic:

    As you can see I'm building two tables within one Comment. Is there a possibility to add a kind of if-cause to each of the tables? Of course, I could use twi post functions, but I would be happy If i could solve that with only a single post function..

  6. Patrick Schuh [brainbits] reporter
    "Folgende Anfragen wurden verknüpft:\n" +  
    "||Issue Key||Summary||\n" + toString(textOnIssueList(issueKeysToIssueList(%{00061}), "|" + ^%{00015} + "|" + ^%{00000} + "|"), "\n") +
    "\nFolgende Anfragen wurden automatisch erstellt:\n" + 
    "||Issue Key||Summary||\n" + toString(textOnIssueList(issueKeysToIssueList(%{00098}), "|" + ^%{00015} + "|" + ^%{00000} + "|"), "\n")
    
  7. Fidel Castro Armario repo owner

    Sorry, I don't understand what you mean by if-cause. Do you want to add each table to the comment only when certain conditions are meet? A different condition for each table?

  8. Patrick Schuh [brainbits] reporter

    I want to achieve that no empty table is written. So: if %{00061} = null then do not write first table. if %{00098} = null then do not write second table.

  9. Fidel Castro Armario repo owner

    Use this expression:

    (count(issueKeysToIssueList(%{00061})) > 0 ? "Folgende Anfragen wurden verknüpft:\n" +  
    "||Issue Key||Summary||\n" + toString(textOnIssueList(issueKeysToIssueList(%{00061}), "|" + ^%{00015} + "|" + ^%{00000} + "|"), "\n") : "") +
    (count(issueKeysToIssueList(%{00098})) > 0 ? "\nFolgende Anfragen wurden automatisch erstellt:\n" + 
    "||Issue Key||Summary||\n" + toString(textOnIssueList(issueKeysToIssueList(%{00098}), "|" + ^%{00015} + "|" + ^%{00000} + "|"), "\n") : "")
    
  10. Log in to comment