Xporter JQL / populate Word document with variable from another issue and another issuetype

Yannick Philippets July 22, 2021

Hi everyone,

 

To present my expectations : I launch the export from an issue "Issue1" of type "MyIssueType" to a Word document, and I need some informations (an address) contained in another issue which depends on the country completed in a field of "Issue1". I have a set of issues used as templates (one template per country), whose name is like "MyTemplate_Country" (i.e. "MyTemplate_France", "MyTemplate_US", ...), of another type "TemplateAddress".

 

Here below my Word template, where ${Summary}, ${IdCountry} and ${Name} come from fields from "Issue1", and ${JQLIssues[i].IdCountry} and ${JQLIssues[i].Address} come from fields on the right "MyTemplate_Country" :

----------------

#{for i=JQLIssuesCount|clause=project = "MyProject" AND summary ~ "MyTemplate_" AND issuetype = TemplateAddress}

#{if (%{'${IdCountry}'.equals('${JQLIssues[i].IdCountry}')})}

   Title: ${Summary}

   Name: ${Name}

Address : ${JQLIssues[i].Address}

#{end}

#{end}

----------------

 

This JQL query works very well if "MyTemplate_Country" and "Issue 1" have the same issuetype. But as soon as I use the "TemplateAddress" type, the query fails and no template is found...

 

Do you know where the problem would be please ?

 

 

Thanks by advance,

 

Yannick.

 

1 answer

0 votes
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.
July 28, 2021

Hi @Yannick Philippets 

I am not sure if I fully understood the organization that you have, however it should be related to this condition:

#{if (%{'${IdCountry}'.equals('${JQLIssues[i].IdCountry}')})}

And the JQL query:

#{for i=JQLIssuesCount|clause=project = "MyProject" AND summary ~ "MyTemplate_" AND issuetype = TemplateAddress}

 

In this condition, you compare the country of the current issue with the country of the issue returned from the JQL query. So if the JQL returned values don't match the country in the current issue, it would not return any value.

I would suggest to print the issue keys and the country id to debug this. Add something like this to your template:

${Key}    ${IdCountry}

${JQLIssues[i].Key}    ${JQLIssues[i].IdCountry}

 

By comparing the values, you should be able to check what is failing.

Thank you.

Kind regards,
Rogério Paiva [Xporter Support Team]

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events