Clearing an assigned value and assigning different value to it

Hello.

Does anyone have an example of how to implement this:

  1. Have a blank TEA in Stage 1
  2. Assign “2” to the TEA in Stage 2
  3. Assign “1” to the TEA in Stage 1
  4. Assign “2” to the TEA in Stage 2
  5. Assign “1” to the TEA in Stage 1
    And so on…

I’ve tried to implement this but what’s happening is that once you assign “2” in step 2, it never changes.

Thanks in advance!

I think in this case you might need to use

  • Trigger rule only for program stage

If a program stage is selected, the program rule will only run for the selected program stage, as opposed to being run for every program stage in the program. dhis2 docs

It will also mean that you’ll need to create a program rule for each stage. Please try it and let me know if it worked! Thanks! :blush::+1:

So I’ve tried that but the problem is that the result of the program rule is to hide the other program stage and the hiding isn’t working. So when set to 1, hide stage 1 then stage 2 is visible, when stage 2 is completed, hide stage 2 and unhide stage 1. Make sense? So with Hide Program Stage rules, they can’t be set to a particular stage. @Gassim

1 Like

So you mean that it’s set to do this?

  1. Have a blank TEA in Stage 1
  2. Assign “2” to the TEA in Stage 2 + hide program stage 1
  3. Assign “1” to the TEA in Stage 1 + hide program stage 2
  4. Assign “2” to the TEA in Stage 2 + hide program stage 1
  5. Assign “1” to the TEA in Stage 1 + hide program stage 2
    …etc

but I don’t understand if we’re hiding program stage 1 in step 2, how did we return to it in step 3?

Thanks!

Let me update this for you to make it more clear:

  1. Have a blank TEA in Stage 1 + complete stage + hide program stage 1(there’s a separate rule that hides this stage here though)
  2. Assign “2” to the TEA in Stage 2+ complete stage + hide program stage 2 + stop hiding stage 1
  3. Assign “1” to the TEA in Stage 1+ complete stage + hide program stage 1 + stop hiding stage 2
  4. Assign “2” to the TEA in Stage 2 + complete stage + hide program stage 2 + stop hiding stage 1
  5. Assign “1” to the TEA in Stage 1 + complete stage+ hide program stage 1 + stop hiding stage 2
    …etc

Makes better sense?

Okay thanks, so why not make the assign TEA in separate program rule than the hide/unhide rules? Did you try that?

Yes, they are in separate rules but still nothing :frowning:

1 Like