You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
I'm trying to parse multiline field data from an x-ray test, but with no success. Data column is filled with following pattern for one test step :
req1
req2
req3
I tried to use split / exec / match on the content of the data field with endline separator, but I didn't manage to loop over array in order to retrieve details separatly.
#{for i=JQLIssuesCount|clause= issuetype = Test AND key = EVAL-218 }
#{for r=JQLIssues[i].TestStepsCount}
${set(tab, %{‘${escape:JQLIssues[i].TestSteps[r].Data}’.match(/[^\r\n]+/g)})}
// What is the relevant way to loop over ${tab} ?
#{end}
#{end}
Is there a way to loop over a split array and display content individually ?
Thanks
Hi @Tomy
I haven't fully understood what you want to do, however here are some insights that might help.
First, in Xporter, the Javascript code is run embedded under the %{....}, and it does not affect other Javascript code. When there is a %{....} is like calling a subroutine that returns an output.
However it is still possible to make some interesting code, like the one below:
${set(tab, %{var final=""; var steps='${escape:JQLIssues[i].TestSteps[r].Data}'.split('\n'); for (var x=0; i < steps.length; x++) final=final.concat('\t', steps[x]); final})}
In this Javascript it splits the information of Data into an array, then it iterates over the array to build a string of values separeted by tabs, and it returns this output string. Please note that the output must be a simple datatype, like a string or a number.
After, you can add another Javascript line to process the Xporter variable ${tab}. However, and again, it would be processed in a subroutine approach, so it is not possible to iterate over the variable ${tab} like you do for the TestSteps (or other Xray information).
I hope this helps.
Thank you.
Kind regards,
Rogério Paiva [Xray Support Team]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.