Hi, I'm having problems getting an if block to recognize true/false!!
I have the following expression evaluating to true/false successfully in a template:
%{ (‘${Labels}’.search(“it-plan”) >= 0) }
It will print true/false as appropriate. BUT, when I put that expression in an If Block to control formatting I get nothing. But when I remove the if block my issues do get displayed
- Complete loop/block here:
&{for issues}
%{ (‘${Labels}’.search(“it-plan”) >= 0) } <----This Works!
#{if (%{ (‘${Labels}’.search(“it-plan”) >= 0) } )} <--- This doesn't
${Key} | ${Summary} | ||
Team: | <Not implemented yet> | Assigned to: | ${AssigneeUserDisplayName} |
Department: | %{(‘${Department}’.length > 0) ? ‘${Department}’ : ‘No Department’} | State: | ${Status} |
Target Completion: | <Not implemented yet> | Labels: | ${Labels} |
${Reporting Status}
#{end}
&{end}
I found a solution to my problem using another approach. I switched to using a filter approach when I found I could use a "Contains" there. So I updated the For loop and dropped the If block completely. Works fine now.
&{for issues|filter=%{’${Labels}’.contains(‘it-plan’)}}
Have you had any luck (or need) using multiple Logical Operators (|| or &&) within the filter approach? Mine seem to not work as they should.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It might depend on the usage of the operators; however, they should work as in Javascript since it uses a Javascript engine to process it.
If you need further help, please contact Xporter Support (http://Xportersupport.getXporter.app) to share your configuration for the support team to check.
Thank you.
Kind regards,
Rogerio Paiva [Xporter Support Team]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Rogério Paiva - Xray Xporter I don't know what my SEN is and I'm not an administrator, just a Project Lead for my project. Would you be able to take a look and see if you notice why I'm having problems? The code snippet I use is this:
&{for issues|filter=%{'${Additional Details}'.contains('New Buy')&&'${Status}'.equals('Working')||'${Status}'.equals('Contract Development')||'${Status}'.equals('Awaiting Approval')||'${Status}'.equals('Backlog')||'${Status}'.equals('Barrier')||'${Status}'.equals('Waiting For Customer')||'${Status}'.equals('Active')||'${Status}'.equals('Contracting Department')}}
I would expect only issues that have "New Buy" listed in the Additional Details field would populate (which have any of the corresponding Statuses listed). But what ends up happening is that some issues are populated that do not have "New Buy" listed in the Additional Details field. Basically I'm only trying to pull those issues with "New Buy" listed with any of the Statuses present in the code.
Thanks for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, indeed, it is necessary to have the SEN (Support Entitlement Number) to have support. However, if you have an Active license (but don't know the SEN), open the ticket with a company email and provide information about the company, and we will try our best.
About your code, the OR conditions should be grouped between parenthesis to evaluate the OR conditions together. With the current condition, the AND only applies between the Additional Details and the Status "working"; it does not apply to all the other statuses.
I have expanded the code to give you an example of where the parenthesis needs to be placed:
In the template, you need to have this code in a single line.
Please get in touch with Xray Support (http://Xraysupport.getXray.app) if you need further help.
Thank you.
Kind regards,
Rogerio Paiva [Xray Support Team]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much @Rogério Paiva - Xray Xporter ! I’ll give it a shot to see how it works. I figured I was missing something fairly simple but just wasn’t getting there. If I have any other issues I’ll get in touch with the support team as you suggested. Thanks again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.