Validation Rule for Yes Only Tick boxes

Hello Developers,

This is a different question, but tangentially related to my forthcoming question about Option Sets:

How does one make a validation rule using the yes/only tick boxes?

(The following examples are pretty rudimentary, I’ve created a blank 2.20 instance just for testing this logic out) While my example might be a good case for the tracker (which has radio buttons for Option Sets), this will be all part of a much larger aggregate data entry form.

It seems that analytics interpret a :ballot_box_with_check: as a “1” in 2.18 (2.20 the jury is still out), which makes doing things like pivot table very straight forward. When I applied that logic to the validation rules I have come up empty.

So I have three optionCombos for a data element:

Inline image 1

I’d like to prevent the user from checking more than one box. The ideal thing would be to make a radio button, but the users don’t have the time/expertise to set up and maintain a custom form, so I am left with validation rules.

So I made a validation rule where the Left side:

Inline image 3

and the right side is “1”

Inline image 4

and the operator was ==

I tried many variations of operator, and have even put in things that can never be true, and in every case I cannot get the validation step to come back with anything but passed:Inline image 2

Am I missing any kind of gotcha or proper syntax for checking “Yes Only” values? The only other thing I can think of is to have the user input a “1” into a number entry and check that with a validation rule.

I checked what this looked like in the DB, and they are coded as “true” just like a Yes/No:
Inline image 5

I tried various combinations of “Yes” “yes” “true” “TRUE” and couldn’t get any to take.

Any help on this would be greatly appreciated. Thanks!

image

···

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

Hi Tim,

unfortunately at the moment validation rules only work for numeric data elements. Feel free to write a blueprint for support for boolean values.

It will however change the way rules are being evaluated in aggregate forms. Perhaps this could rather be implemented as an anonymous event program, where we have support for more sophisticated “program rules”?

regards,

Lars

image

image

image

image

image

image

···

On Sun, Sep 27, 2015 at 11:52 AM, Timothy Harding tharding@baosystems.com wrote:

Hello Developers,

This is a different question, but tangentially related to my forthcoming question about Option Sets:

How does one make a validation rule using the yes/only tick boxes?

(The following examples are pretty rudimentary, I’ve created a blank 2.20 instance just for testing this logic out) While my example might be a good case for the tracker (which has radio buttons for Option Sets), this will be all part of a much larger aggregate data entry form.

It seems that analytics interpret a :ballot_box_with_check: as a “1” in 2.18 (2.20 the jury is still out), which makes doing things like pivot table very straight forward. When I applied that logic to the validation rules I have come up empty.

So I have three optionCombos for a data element:

I’d like to prevent the user from checking more than one box. The ideal thing would be to make a radio button, but the users don’t have the time/expertise to set up and maintain a custom form, so I am left with validation rules.

So I made a validation rule where the Left side:

and the right side is “1”

and the operator was ==

I tried many variations of operator, and have even put in things that can never be true, and in every case I cannot get the validation step to come back with anything but passed:

Am I missing any kind of gotcha or proper syntax for checking “Yes Only” values? The only other thing I can think of is to have the user input a “1” into a number entry and check that with a validation rule.

I checked what this looked like in the DB, and they are coded as “true” just like a Yes/No:

I tried various combinations of “Yes” “yes” “true” “TRUE” and couldn’t get any to take.

Any help on this would be greatly appreciated. Thanks!

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Will do, thanks for the input Lars,

This portion of the form definitely belongs in the anonymous event side, but it is just one small part of a larger monthly aggregate form, so it is why I was trying the work around. I will see about writing a blue print. Thanks again!

image

image

image

image

image

image

···

On Mon, Sep 28, 2015 at 7:46 AM, Lars Helge Øverland larshelge@gmail.com wrote:

Hi Tim,

unfortunately at the moment validation rules only work for numeric data elements. Feel free to write a blueprint for support for boolean values.

It will however change the way rules are being evaluated in aggregate forms. Perhaps this could rather be implemented as an anonymous event program, where we have support for more sophisticated “program rules”?

regards,

Lars

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

On Sun, Sep 27, 2015 at 11:52 AM, Timothy Harding tharding@baosystems.com wrote:

Hello Developers,

This is a different question, but tangentially related to my forthcoming question about Option Sets:

How does one make a validation rule using the yes/only tick boxes?

(The following examples are pretty rudimentary, I’ve created a blank 2.20 instance just for testing this logic out) While my example might be a good case for the tracker (which has radio buttons for Option Sets), this will be all part of a much larger aggregate data entry form.

It seems that analytics interpret a :ballot_box_with_check: as a “1” in 2.18 (2.20 the jury is still out), which makes doing things like pivot table very straight forward. When I applied that logic to the validation rules I have come up empty.

So I have three optionCombos for a data element:

I’d like to prevent the user from checking more than one box. The ideal thing would be to make a radio button, but the users don’t have the time/expertise to set up and maintain a custom form, so I am left with validation rules.

So I made a validation rule where the Left side:

and the right side is “1”

and the operator was ==

I tried many variations of operator, and have even put in things that can never be true, and in every case I cannot get the validation step to come back with anything but passed:

Am I missing any kind of gotcha or proper syntax for checking “Yes Only” values? The only other thing I can think of is to have the user input a “1” into a number entry and check that with a validation rule.

I checked what this looked like in the DB, and they are coded as “true” just like a Yes/No:

I tried various combinations of “Yes” “yes” “true” “TRUE” and couldn’t get any to take.

Any help on this would be greatly appreciated. Thanks!

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Sounds good.

image

image

image

image

image

image

···

On Mon, Sep 28, 2015 at 11:41 AM, Timothy Harding tharding@baosystems.com wrote:

Will do, thanks for the input Lars,

This portion of the form definitely belongs in the anonymous event side, but it is just one small part of a larger monthly aggregate form, so it is why I was trying the work around. I will see about writing a blue print. Thanks again!

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007

On Mon, Sep 28, 2015 at 7:46 AM, Lars Helge Øverland larshelge@gmail.com wrote:

Hi Tim,

unfortunately at the moment validation rules only work for numeric data elements. Feel free to write a blueprint for support for boolean values.

It will however change the way rules are being evaluated in aggregate forms. Perhaps this could rather be implemented as an anonymous event program, where we have support for more sophisticated “program rules”?

regards,

Lars

On Sun, Sep 27, 2015 at 11:52 AM, Timothy Harding tharding@baosystems.com wrote:

Hello Developers,

This is a different question, but tangentially related to my forthcoming question about Option Sets:

How does one make a validation rule using the yes/only tick boxes?

(The following examples are pretty rudimentary, I’ve created a blank 2.20 instance just for testing this logic out) While my example might be a good case for the tracker (which has radio buttons for Option Sets), this will be all part of a much larger aggregate data entry form.

It seems that analytics interpret a :ballot_box_with_check: as a “1” in 2.18 (2.20 the jury is still out), which makes doing things like pivot table very straight forward. When I applied that logic to the validation rules I have come up empty.

So I have three optionCombos for a data element:

I’d like to prevent the user from checking more than one box. The ideal thing would be to make a radio button, but the users don’t have the time/expertise to set up and maintain a custom form, so I am left with validation rules.

So I made a validation rule where the Left side:

and the right side is “1”

and the operator was ==

I tried many variations of operator, and have even put in things that can never be true, and in every case I cannot get the validation step to come back with anything but passed:

Am I missing any kind of gotcha or proper syntax for checking “Yes Only” values? The only other thing I can think of is to have the user input a “1” into a number entry and check that with a validation rule.

I checked what this looked like in the DB, and they are coded as “true” just like a Yes/No:

I tried various combinations of “Yes” “yes” “true” “TRUE” and couldn’t get any to take.

Any help on this would be greatly appreciated. Thanks!

Timothy Harding
Sr. Systems Analyst, BAO Systems

+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org