Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,991
Community Members
 
Community Events
176
Community Groups

Xporter - Parse multiline field

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

1 answer

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]

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events