# Clearing an assigned value and assigning different value to it

**URL:** <https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959>\
**Category:** Support - Assistance technique\
**Tags:** tracker\
**Created:** [20 April 2022 08:27 UTC](https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959 "2022-04-20T08:27:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clara](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/clara/32/33123_2.png) [@Clara](https://community.dhis2.org/u/Clara)\
**Post date:** [20 April 2022 08:27 UTC](https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959/1 "2022-04-20T08:27:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [20 April 2022 12:30 UTC](https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959/2 "2022-04-20T12:30:08Z")

</div>

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](https://docs.dhis2.org/en/use/user-guides/dhis-core-version-master/configuring-the-system/programs.html#:~:text=Trigger%20rule%20only%20for%20program%20stage)

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! 😊👍

---

<div class="post-metadata">

**Author:** ![Clara](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/clara/32/33123_2.png) [@Clara](https://community.dhis2.org/u/Clara)\
**Post date:** [20 April 2022 12:37 UTC](https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959/3 "2022-04-20T12:37:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [20 April 2022 12:43 UTC](https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959/4 "2022-04-20T12:43:08Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Clara](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/clara/32/33123_2.png) [@Clara](https://community.dhis2.org/u/Clara)\
**Post date:** [20 April 2022 12:48 UTC](https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959/5 "2022-04-20T12:48:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [20 April 2022 13:03 UTC](https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959/6 "2022-04-20T13:03:40Z")

</div>

> [@Clara](#):
>
> So when set to 1, hide stage 1 then stage 2 is visible,

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

---

<div class="post-metadata">

**Author:** ![Clara](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/clara/32/33123_2.png) [@Clara](https://community.dhis2.org/u/Clara)\
**Post date:** [20 April 2022 14:59 UTC](https://community.dhis2.org/t/clearing-an-assigned-value-and-assigning-different-value-to-it/46959/7 "2022-04-20T14:59:11Z")

</div>

Yes, they are in separate rules but still nothing ☹
