"Error"-type program ruled triggered before data entry opens

Hi devs, I have a tracker program with registration, with a few program rules of the type «Show error preventing completion». The program has only one stage, which is auto-generated and opened for data entry on registration.

In the latest builds of 2.24 and 2.25, these rules are triggered as soon as I click «Save and continue» on the registration page, and I get a message «Please review and fix the following error(s) before registering:». However, all the variables in the program rules relate to data elements in the program stage and not TEI attributes, so I wouldn’t expect them to run until I try to complete the program stage. As it is now, it is not possible to even get to the program stage data entry.

Any ideas on whether this could be some sort of setting/configuration issue, or if its a bug? I doesn’t seem to behave the same way on the demo instance when I tried to add a similar rule there.

Regards

Olav

Hi Olav,
until recently the “Show error preventing completion” was ignored by the registration form. To have it more uniform with how other rules relate to the registration form - and support the “First stage appears on registration page” better - this was changed. Now the rules are being run in the same way as other rules, and the errors is displayed preventing registration/enrollment. However, assuming the “First stage appears on registration page” option is not used, all the variables will have their default values. Numeric fields will be evaluated as 0 for example, and most other data types will be considered empty strings for evaluation purposes. The d2:hasValue(‘variableName’) should evaluate to false.

Perhaps you can add a clause making sure the rule only triggers when you want? For example adding && d2:hasValue(‘variableName’)

Another and perhaps more elegant option it to tell the rule to run only on a certain program stage. This has no UI at the moment and require you to edit through the API or directly in the database. If you assign the programStage attribute of the programRule, or populate the programstage column of the programrule database table, that particular rule will only run for the program stage you have assigned.

Markus

···
  1. jan. 2017 kl. 14.34 skrev Olav Poppe olav.poppe@me.com:

Hi devs, I have a tracker program with registration, with a few program rules of the type «Show error preventing completion». The program has only one stage, which is auto-generated and opened for data entry on registration.

In the latest builds of 2.24 and 2.25, these rules are triggered as soon as I click «Save and continue» on the registration page, and I get a message «Please review and fix the following error(s) before registering:». However, all the variables in the program rules relate to data elements in the program stage and not TEI attributes, so I wouldn’t expect them to run until I try to complete the program stage. As it is now, it is not possible to even get to the program stage data entry.

Any ideas on whether this could be some sort of setting/configuration issue, or if its a bug? I doesn’t seem to behave the same way on the demo instance when I tried to add a similar rule there.

Regards

Olav


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

Thanks, Markus. Will assign the programStage attribute to the programrule then, as the rules are in fact just checking that one in a set of data elements has a value, e.g. a d2:hasValue clause wouldn’t work.

Olav

···
  1. jan. 2017 kl. 14.52 skrev Markus Bekken markus.bekken@gmail.com:

Hi Olav,
until recently the “Show error preventing completion” was ignored by the registration form. To have it more uniform with how other rules relate to the registration form - and support the “First stage appears on registration page” better - this was changed. Now the rules are being run in the same way as other rules, and the errors is displayed preventing registration/enrollment. However, assuming the “First stage appears on registration page” option is not used, all the variables will have their default values. Numeric fields will be evaluated as 0 for example, and most other data types will be considered empty strings for evaluation purposes. The d2:hasValue(‘variableName’) should evaluate to false.

Perhaps you can add a clause making sure the rule only triggers when you want? For example adding && d2:hasValue(‘variableName’)

Another and perhaps more elegant option it to tell the rule to run only on a certain program stage. This has no UI at the moment and require you to edit through the API or directly in the database. If you assign the programStage attribute of the programRule, or populate the programstage column of the programrule database table, that particular rule will only run for the program stage you have assigned.

Markus

  1. jan. 2017 kl. 14.34 skrev Olav Poppe olav.poppe@me.com:

Hi devs, I have a tracker program with registration, with a few program rules of the type «Show error preventing completion». The program has only one stage, which is auto-generated and opened for data entry on registration.

In the latest builds of 2.24 and 2.25, these rules are triggered as soon as I click «Save and continue» on the registration page, and I get a message «Please review and fix the following error(s) before registering:». However, all the variables in the program rules relate to data elements in the program stage and not TEI attributes, so I wouldn’t expect them to run until I try to complete the program stage. As it is now, it is not possible to even get to the program stage data entry.

Any ideas on whether this could be some sort of setting/configuration issue, or if its a bug? I doesn’t seem to behave the same way on the demo instance when I tried to add a similar rule there.

Regards

Olav


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