So my friend @Mourad Marzouk asked in the Adaptavist forum:
But because Groovy makes my head hurt, I went ahead and posted an answer on how to do it with Automation, which well... probably belongs here.
Also, I think this is a simpler solution for this (if I'm interpreting the original question correctly):
The table we're splitting looks like this:
Old Part # |
Old Rev |
New Part # |
New Rev |
Part Description |
Procurement/End Item |
---|---|---|---|---|---|
Part number 1 |
Old Revision 1 |
Part number 1 |
Revision 1 |
Description 1 |
End Item 1 |
Part number 2 |
Old Revision 2 |
Part number 2 |
Revision 2 |
Description 2 |
End Item 2 |
If you look at the wiki source for this table, it looks like this:
||*Old Part #*||*Old Rev*||*New Part #*||*New Rev*||*Part Description*||*Procurement/End Item*||
|Part number 1|Old Revision 1|Part number 1|Revision 1|Description 1|End Item 1|
|Part number 2|Old Revision 2|Part number 2|Revision 2|Description 2|End Item 2|
First you split the description by newlines: {{issue.description.split("\n")}}, and iterate through each line with the For each advanced branching.
Then for each line ({{row}}), if it doesn't contain || (header), but does start with a |, then create a new subtask.
First you split the description by newlines: {{issue.description.split("\n")}}, and iterate.
First column (Old part #) is: {{row.split("\|").get(1)}}
(Numbering starts with 0, but because the tables _start_ with a pipe character, we actually are getting the second column). Example:
0|1|2|3|4|5|6||Part number 1|Old Revision 1|Part number 1|Revision 1|Description 1|End Item 1|
Now this assumes that you only have one table per Description, and also that there aren't any other random lines that start with a | (pipe) character.
It might be safer to change the second comparison to exactly matches regular expression and use this:
^\|.*\|$
Darryl Lee
Sr. Atlassian Systems Engineer
Roku, Inc.
San Jose, CA
199 accepted answers
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
3 comments