Program Rule Error Message: Qual método de PF was blanked out and hidden by your last action

Greetings,

Iam using dhis2 2.33.3 for tracker capture that is meant for android

I am trying to hide/show fields depending on a user selection. I would like to hide Qual método de PF data element if the user selects yes on A mãe está a fazer PF and also hide A mãe é utente de CBD if Options pilula or preservatvos is selected on Qual método de PF (which is an ption set).
image

I have created two program rules:

  1. Hide data element Qual método de PF; This one works, but I get the error: Qual método de PF was blanked out and hidden by your last action



  2. Hide data element A mãe é utente de CBD. This one doesn’t work.
    image
    image
    image

Thanks

Hello,
Please refer Here: Program rule, assign value by summing boolean data elements - #9 by abdimohammed.
Might be helpful.

Hi @abdimohammed,

I have read the post you have directed me to, but what I want is to hide a data element based on the options selected from an option set. I want to hide A mae e utente de CBD if the options are not Pilula or Preservativos. The relational operator OR doesn’t seem to be working:


thanks

Try to separate your rules.
Make two separate rules with expressions like: d2:hasValue(‘Metodo_PF’) && #{Metodo_PF} hide Qual método de PF
Then do the next rule as d2:hasValue(‘preservation’) && #{preservation} hide A mãe é utente de CBD.
If the two are in different program stages, the dont assign trigger rule for program stage.

Hi @abdimohammed,

Both Qual método de PF and A mãe é utente de CBD .are in the same program stage. I can’t get things working after following your explanation. In the image below, The data element Qual método de PF has five options, and I want to hide the last data element A mãe é utente de CBD .if either Pilula or preservativos is selected.

That is the reason I tried to use the logical operator in the program rule, but it does not work.
image

Thanks. More help is appreciated

Generate resource table then try again.

Thanks @abdimohammed,

Things are working now.

Welcome @dmbantu
Please remeber to mark the answer that worked for you as the solution to help other people who may face a similar problem.