Problem to hide Program Stage using program rule

I am facing problem to hide program stage on my tracker program. I have checked my program rule,it seems there is no error on it but the program stage was not hidden. I am using DHIS2 2.33.

Hi @manish198,

Can you share the screenshot of your rule condition?

Thank you Sir for your concern.
Here is my program rule and program rule action.


It is not working.

1 Like

Hi @manish198,

Sorry for late reply, I was away on my annual leave.

I don’t see anything wrong on the condition. Is your issue solved?

1 Like

Thank you Sir, for the reply.
No, it is not fixed yet.

1 Like

Hi @manish198 Have you tried replacing the curly brackets on the variable {...} with single quotes '....' ? Please try and let us know if it works

@jomutsani

That would not be correct. Some functions like d2:hasValue() require progrulevariables encapsulated in single quotes, but not a straight reference to a data element progrulevariable like this.

regards
calle

1 Like

Hi @manish198,

How do you capture value for Regimen_Used? Text field or Option set?

If Option set, can you share the screenshot for this particular value (SSTR) you are comparing?

And, have you checked whether you have used exact spelling for the variable name (regimen_used instead of Regimen_Used)?

1 Like

Hi @Calle_Hedberg, thanks for your feedback; how best can we help @manish198 achieve his request?

One thing that might be good to clarify:
The “Hide program stage” action might not be perfectly named. It does not hide an event that is already added. What it does is that it will hide the option of adding a new stage in the given program stage, and perhaps we should rename it to “Hide option of adding program stage”. The use case for it is to help the user fill in/add the correct program stage based on other data in your form. For example, it enables you to hide the option of adding a “Antenatal care followup” event of the patient has not been recorded having the “Antenatal care first/baseline visit” event.

This might or might not have been your issue?

1 Like

Hi,

Just some stray thoughts:
1.
Check the point raised by Markus: the “hide program stage” action would only actually hide non-existing stage events - not stage events that has already been captured e.g. before this program rule was created.
2.
It seems the expression is checking for a specific option value CODE, so make sure that the “use code for option set” is ticked for the “Regimen Used” progrulevariable
3.
Verify that no other prog rule is failing - I have seen before that one failed program rule makes all subsequent prog rules to fail too.
4.
Any error message in e.g. the tomcat log?

Regards
calle

1 Like