Forums

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

Javascript "includes" not working in xporter template

Stefan Salzl
Community Champion
April 11, 2024

Hi Community,

help needed. xPorter "syntax" is driving me crazy. I have a field that contains the country shortcut (like eg. AT for Austria, DE for Deutschland, ....).

I would like to check/report, if it´s a member of the EU and print this in my report. But xporter is driving me nuts and doesn´t allow any of my ideas.....

Here is my most prefered idea:

 

${set(EU,‘AT,DE,IT,BR,GR’)}

EU-Mitglied? : %{‘${EU}’.split(‘,’).includes(‘AT’) ? ‘Ja’ : ‘Nein'}

 

Unfortunately it doesn´t print anything....

 

Best
Stefan

1 answer

1 accepted

0 votes
Answer accepted
Stefan Salzl
Community Champion
April 14, 2024

so obviously xporter just says "use javascript" but doesn´t allow plain/whole functionality of javascript. fun fact: They don´t explicitly mention what is possible and what isn´t.

In general the documentation is really bad and unstructured AND even outdated (official docu pages from ! 2018 !)

 

as (obviously) using .include() method is not allowed I solved this with a ternary operater using OR-condition-chaining. Not the most beautiful way but at least it does what it should:



%{ ‘${Land}’.equals(‘AT’) || ‘${Land}’.equals(‘DE’) ? ‘Ja’ : ‘Nein'}

(the variable 'Land' is set before from issue data)

 

Hope this is also helpful for other users.

 

Best
Stefan

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events