0

The error occurs on this if statement:

<if test="equal" value1="{$m.parent_id}" value2="{$var.tasks-menu-id}">
    <math:increment field="var.tasks-children"/>
</if>

I've double checked that the dataset field references are returning the correct value, and the test should work even if one or both of the values are null.

Adam Sharp
  • 3,618
  • 25
  • 29

1 Answers1

0

The "If condition did not produce a Boolean value" error was actually somewhat misleading, as there is nothing wrong with the way I've set up the test in the if element. Here is the problem:

Either the <then> or <else> sub-element can be omitted if no action is required under that condition.

The if command requires either one or both of then or else as its children. In this case, the command used as the body of the if was being treated as a condition, and the error is due to it not having a (boolean) return value.

This works:

<if test="equal" value1="{$m.parent_id}" value2="{$var.tasks-menu-id}">
    <then>
        <math:increment field="var.tasks-children"/>
    </then>
</if>
Adam Sharp
  • 3,618
  • 25
  • 29
  • It isn't an error to have neither a then block nor an else block, it just isn't very useful (unless the test has a side-effect). The error is that the command which was intended for a then block was instead set as the if condition. On the one hand it would be useful if there was a conditions block added for non-inline conditions, on the other hand that would mean more indenting. – Tristan Wilkinson Sep 26 '12 at 00:07
  • @TristanWilkinson thanks, I've updated my answer accordingly. – Adam Sharp Sep 26 '12 at 00:15