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}' : ‘’}