Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Export Field title +values- but only if field is populated. If not populated then NO title pls

Lawrence Ritchie
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 17, 2022

I am using Xray to export my project issues to Excel.

What I would like to do is export the links from each issue of a project with the heading 'Links' if they are present.

If no links are present I do not want the heading 'Links' to appear.

 

I have tried an if statement with LinksCount:

#{if LinksCount >0}

Links:

#{for j=LinksCount}

#{if (%{'${Links[j].LinkType}'.equals('comprises')})}

Child: ${Links[j].Key}

#{end}

#{if (%{'${Links[j].LinkType}'.equals('part of ')})}

Parent: ${Links[j].Key}

#{end}

#{if (%{'${Links[j].LinkType}'.equals('tested by')})}

Tested by: ${Links[j].Key}

#{end}

 #{end}

#{end}

 

I have also tried Javascript, which works for a custom Notes field but not for 'Links' :)

%{('${Notes}'.length > 0) ? 'Notes: ${Notes}' : ‘’}

1 answer

1 accepted

1 vote
Answer accepted
Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2022

Hi @Lawrence Ritchie 

Please try with the condition code like this:

#{if (%{${LinksCount} > 0})}

The evaluation of the value comparison needs to be done inside Javascript, like found in the documentation (https://confluence.getxray.app/display/public/XPORTERCLOUD/Conditional+Blocks).

I hope it helps.

Thank you.

Kind regards,
Rogerio Paiva [Xray Support Team]

Suggest an answer

Log in or Sign up to answer