← Back to team overview

dhis2-users team mailing list archive

Re: 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)

Regards,
antonia

 www.informa.pro - *Seguici su *LinkedIn
<https://www.linkedin.com/company/informapro>
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

2017-02-14 22:21 GMT+01:00 Smith, Rebecca A. <rs3524@xxxxxxxxxxxxxxxxx>:

> 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?
>
>
>
> Thanks!
>
> Becky
>
>
>
>
>
>
>
> Becky Smith
>
> Development-Operations Specialist
>
> ICAP at Columbia University
>
> Tel: 212.304.7109 <(212)%20304-7109>
>
> Email: rs3524@xxxxxxxxxxxxxxxxx
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>