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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Xporter not working with conditionals in iteration, even with Javascript

Hello!

I have a custom Checkboxes field and I would like to create a report with all possible values listed alongside a checkbox indicating whether the value is included.

For example, assume the `ImpactCategory` custom field has the possible values ["Safety", "Cybersecurity", "Patient Satifaction"]. If my issue included just Safety and Cybersecurity, I would like to output:

Safety:
☒ Yes ☐ No
Cybersecurity:
☒ Yes ☐ No
Patient Satifaction:
☐ Yes ☒ No

I have tried several approaches here and nothing has worked so far.

When I use this format, the report includes a comma-separated list of the checked values in the field.

${ImpactCategory}

However, when I try to iterate through the custom field, it fails. For example, nothing is printed when I use this syntax:

#{for ImpactCategory}
${ImpactCategory[n]}
#{end}

I have been able to use Javascript with the following syntax to split the comma-separated string into an array and then iterate through the array. However, it only prints the last item:

%{ var output; var c = '${ImpactCategory[10183]}'.split(','); for (var i = 0; i < c.length; i++) { c[i] }}

When I attempt to use conditional logic in the Javascript, it prints nothing. For example:

%{ var output; var c = '${ImpactCategory[10183]}'.split(','); for (var i = 0; i < c.length; i++) { if (c[i]) === "Cybersecurity" { output = c[i] } else { output = "No" }} output; }

I noticed a similar question here: https://community.atlassian.com/t5/Jira-questions/Xporter-How-to-iterate-over-a-multi-element-custom-field/qaq-p/765742. However, even though the most recent comment says this is resolved, the solution does not work.

Is there any way to achieve this functionality?

Thanks in advance for your help!
-Adam

1 answer

Hi @Adam Price 

Concerning the concrete situation you're facing, you'll need to provide more data so I recommend you reach out Xray support and the support team will be glad to help you out.

Best Regards,

Sergio 

_____________

Solution Architect and Testing Advocate @Xray

Personal blog on testing, Agile, and software development: https://sergiofreire.com

Follow me on Twitter: https://twitter.com/darktelecom

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

727 views 7 24
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you