Validation Rules with zeros and nulls

Hi Becky,

in the program rules you can use the function d2:hasValue(‘<var_name>’) to verify if the variable has value.

for example to check if the “MotherAge” is between 10 and 70 you can use the rule

d2:hasValue(‘MotherAge’) && (#{MotherAge} > 70|| #{MotherAge} < 10)




2017-02-14 22:21 GMT+01:00 Smith, Rebecca A.

Hi DHIS community,

Could someone advise me on how to distinguish between a zero and a null in a validation rule?

Basically, I want the validation to pass if a data value is not blank. It should pass even if the value is zero, as long as it’s is filled in. “Zero is significant” is on.

I tried d2:hasValue from the program rules, but got the “expression is not well-formed” message. Is there a different way to check this in validation rules?



Becky Smith

Development-Operations Specialist

ICAP at Columbia University

Tel: 212.304.7109


Mailing list:

Post to :

Unsubscribe :

More help : - *Seguici su *LinkedIn

INFORMAPRO S.r.l. - via Luigi Rava 43, Rome 00149 , Italy
tel. +39 06 5758926, fax +39 06 62207168, P.IVA IT08095781004

Skype: informa_antonia.bezenchek
Eng. Antonia Bezenchek - CIO - ICT Engineer