Avoiding "0" values in Specify 7 xml label

Dear Specify colleagues,

kindely asking your help to avoid zero expressions in Specify 7 labels:

this expression seems not working to avoid "Det " values in the label, when the deterimenr is absent:

it worked well in Specify 6,
should i modify it to make it working in Specify 7,
or am i missing something…


<textFieldExpression   class="java.lang.String"><![CDATA[$F{1,9-determinations,5-determiner.agent.determiner}==null?"": "Det " +$F{1,9-determinations,5-determiner.agent.determiner}]]></textFieldExpression>

Hi Nina,

The principal difference is that Specify 7 treats a blank record format, such as a blank value for a Determiner in this query line, as an empty value rather than no value.

This confuses the expression and causes it to show "Det " with or without a determiner.

To avoid this, I reccomend making the conditional look at another field value such as lastName in the Agent table (i.e. 1,9-determinations,5-determiner.agent.lastName) to determine if the agent exists or not.

It would look something like this in the app resource for the report:

<textFieldExpression   class="java.lang.String"><![CDATA[$F{1,9-determinations,5-determiner.agent.lastName}==null?"": "Det " +$F{1,9-determinations,5-determiner.agent.determiner}]]></textFieldExpression>

To keep it simple, I recommend making this change in 6 by adding that field to the query and editing this expression using iReport.

If you’d like to do it the Specify 7 way, you can add this line to the list of fields in the report definition after adding the lastName field to the query linked to the report:

<field name="1,9-determinations,5-determiner.agent.lastName" class="java.lang.String"/>

Then you could replace the expression with the one I gave above.

Let me know if you have any trouble with this!

Dear Grant,

Thank you for the explanation,

i edited the Specify 7 xml for this label using your expressions and it works fine now!

Nina.