Thanks Seth and Antonia for your suggestions. Unfortunately, both the ' ' empty string and d2:hasValue function result in an "Expression is not well-formed" message that prevents creation of the validation rule. Seems that the program rules and validation rules differ greatly in how they handle blanks and string comparisons.
Thanks, Becky From: Seth Okeyo [mailto:sok...@dndi.org] Sent: Wednesday, February 15, 2017 11:10 AM To: Smith, Rebecca A.; Lars Helge Øverland Cc: dhis2-users Subject: Re: [Dhis2-users] Validation Rules with zeros and nulls Dear Becky, If i get your question well, I had almost a similar issue back in creating program rules, try using ' ' which is a single quote with a space in between to represent null values.. e.g. #{yUVXpYVeY6I.AMRBmklLli1} != ' ' (not equal to null) This worked for me. Kind Regards Seth Okeyo| Data Management Officer Drugs for Neglected Diseases initiative - Africa Regional Office Tetezi Towers, 3rd Floor, George Padmore Road, Kilimani| P.O. Box 21936 - 00505| Nairobi | Kenya T: +254 020 3995000 | M: +254 727 389 149| sok...@dndi.org<mailto:sok...@dndi.org> | skype: dndi_seth.okeyo Best Science for the Most Neglected | www.dndi.org<http://www.dndi.org/> ________________________________ From: Dhis2-users <dhis2-users-bounces+sokeyo=dndi....@lists.launchpad.net<mailto:dhis2-users-bounces+sokeyo=dndi....@lists.launchpad.net>> on behalf of Smith, Rebecca A. <rs3...@cumc.columbia.edu<mailto:rs3...@cumc.columbia.edu>> Sent: Wednesday, February 15, 2017 6:58:09 PM To: Lars Helge Øverland Cc: dhis2-users Subject: Re: [Dhis2-users] Validation Rules with zeros and nulls Thanks Lars. Unfortunately, this isn't working for me. It's still treating the blank data value as a zero and passing validation with blanks. In case there have been changes in later builds - this is version 2.25 build da6a2df. Ideally, we would also like to be able to compare to NULL on one side of the equation, so that we can do more complex logic (e.g. : #{Data Value A} NOT NULL || #{Data Value B} > 0). But that might be beyond the scope of what the validation rules can do right now. Appreciate your feedback! Thanks, Becky From: Lars Helge Øverland [mailto:l...@dhis2.org] Sent: Tuesday, February 14, 2017 5:02 PM To: Smith, Rebecca A. Cc: dhis2-users Subject: Re: [Dhis2-users] Validation Rules with zeros and nulls Hi Becky, did you try creating a rule like this? - left side missing value strategy is set to "never skip". - left side expression is the relevant data element. - operator is "greater than or equal to". - right side missing value strategy is set to "never skip". - right side expression is 0. Lars On Tue, Feb 14, 2017 at 10:21 PM, Smith, Rebecca A. <rs3...@cumc.columbia.edu<mailto:rs3...@cumc.columbia.edu>> wrote: 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 Email: rs3...@cumc.columbia.edu<mailto:rs3...@cumc.columbia.edu> _______________________________________________ Mailing list: https://launchpad.net/~dhis2-users Post to : dhis2-users@lists.launchpad.net<mailto:dhis2-users@lists.launchpad.net> Unsubscribe : https://launchpad.net/~dhis2-users More help : https://help.launchpad.net/ListHelp -- Lars Helge Øverland Lead developer, DHIS 2 University of Oslo Skype: larshelgeoverland l...@dhis2.org<mailto:l...@dhis2.org> http://www.dhis2.org<https://www.dhis2.org/>
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-users Post to : dhis2-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-users More help : https://help.launchpad.net/ListHelp