validating occasionally null properties

12 views
Skip to first unread message

Chris Blackwell

unread,
Jul 12, 2013, 9:14:22 AM7/12/13
to validatethis
I have an object that has a parent-child relationship, it has a property "Rate" which if null is inherited from its parent.  If the property is present it must be a non-negative number. But I can't figure out how to validate it.

I thought I could just use a condition to test if rate was null and then ignore the test like this

<condition name="hasRate" serverTest="!isNull(variables.rate)" />

<property name="Rate">
<rule type="numeric" condition="hasRate" />
<rule type="min" condition="hasRate">
<param name="min" value="0" />
</rule>
</property>

But the rules condition is not evaluated until after VT checks if the property exists (here).
I also can not use ignoreMissingProperties as its then not possible to have a required property.

Does anyone have any thoughts on how to work this out?

Cheers, Chris
Reply all
Reply to author
Forward
0 new messages