JXLS - How to filter result of jx:each command by string occurence

2.6k Views Asked by At

I'm trying to generate a spreadsheet document using a template with jxls commands. I want to filter the elements of a collection that does not contain a specific text.

I attempted to do that using following jxls command:

jx:each(items="Quote.CostList" var="Cost" lastCell="B18" select="${Cost.Type != 'EXCLUDED_TYPE_1' and Cost.Type != 'EXCLUDED_TYPE_2'}")

When I execute the application to generate the spreadsheet I get the following error.

org.apache.commons.jexl2.JexlException$Parsing: org.jxls.expression.JexlExpressionEvaluator.<init>@1:82 parsing error near '... PE_2' ...'
1

There are 1 best solutions below

0
On BEST ANSWER

I was using wrong syntax.

The comment should have been

jx:each(items="Quote.CostList" var="Cost" lastCell="B18" select="Cost.Type != 'EXCLUDED_TYPE_1' and Cost.Type != 'EXCLUDED_TYPE_2'")