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?

3 Likes

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

I am having the same problem in 2.33. I was thinking perhaps instead of having the program variable be based on the current event, the program rule would event based on a previous event but I tried testing that (perhaps incorrectly) and it didn’t work. I need to investigate if other program rules are failing but wanted to bump this in case anyone found a solution for hiding a program stage based on an option set response.

@Natalie_Tibbels did you manage to resolve this? I am having the same issue on v2.34?

Hi @Vusi share your problem. What you tried to do. Can you share screenshots?

Heey @asacur, thanks for coming back to me see below screenshots
Program Variable


Program Rule

Program Action

Hi @vuzi what are the condition to hide? Is when the value is false or when is equal to zero? Last, what type is the datalement ab_BA_ctIPV

if Yes hide where Yes = 0

Option set - Yes=0 and No =1

Hi, can you share the value of the Option. You have to use the value on your PR.

Yes = 0
No = 1