Cannot use the && logical operator in report expressions

Table of Contents 

If you want to create some complex report expressions in which you have to use the Java AND logical operator, you might be surprised to see an error when compiling you report design. The error message would say something like this:

"The entity name must immediately follow the '&' in the entity reference." Don't worry! This is because the '&' character is a special XML character and the XML parser is confused when it encounters such characters in the body of an XML element.

The solution is to use the XML special syntax that allows you to introduce XML special characters in the body of an XML element. Put your expression content between the 




character sequences like in the following demo text field expression:

        $F{MyNumber}.intValue()>=0 && $F{MyNumber}.intValue()<=25 ? "in range" : "out of range"