I can't assign a value to program rule variable as an action


I have created a program rule that is supposed to assign value to a program rule variable. But, when I try to save the program variable I get the following error Couldn't save program rule: DataElement or TrackedEntityAttribute cannot be null for program rule VIS_2_glass_SD.

Please find a screenshots attached.

Thank you for the screenshots! Could you also share the Program Rule Variable configuration?

Thank you!

Thank you for you response.

I have two program rule variables:

What I’m trying to achieve is if the value in VIS_2_glass DE equals ‘Yes - some difficulty’ assign variable VIS_2_glass_SD 1.


I can’t reproduce this issue, but in your instance after selecting the ‘Calculated value’ I can’t see the field which appear to choose the ‘type’ as in the screenshot below:

You can try to reproduce the issue yourself in any of the play.dhis2.org instances to see. Which DHIS2 version are you using? Thanks!

G’day Orly,
Unsure if this will help, but I see there is no DE or TEI to assign the value to in the Pgm Rule Action, so maybe this is why it is throwing the ‘cannot be null’ error

1 Like