# Assign value PR not working as expected

**URL:** <https://community.dhis2.org/t/assign-value-pr-not-working-as-expected/42373>\
**Category:** Support - Assistance technique\
**Created:** [30 March 2021 14:56 UTC](https://community.dhis2.org/t/assign-value-pr-not-working-as-expected/42373 "2021-03-30T14:56:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hernandezmachava](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@hernandezmachava](https://community.dhis2.org/u/hernandezmachava)\
**Post date:** [30 March 2021 14:56 UTC](https://community.dhis2.org/t/assign-value-pr-not-working-as-expected/42373/1 "2021-03-30T14:56:10Z")

</div>

Hi all.  
Assign value PR not triggered immediately

I am trying to assign a tracked entity attribute of type date to a data element, but the program rule seems not to be triggered immediately. Only after clicking on another program stage, I can see the assigned value. For example, in the image below, when I click on A\_2 program stage data de rececao cartao DE is not filled immediately, though when I click on A\_1 and back to A\_2 the value is assigned. I do not what is happening

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/6/0/601b4be43444a7123fcda0842fc235c3324e24ac.png)

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/0/5/052200d3acb8969c742f124bf2f0038bec4fc3d9.png)

The other problem is that the order of program stages has changed (A\_2,A\_1) instead of (A\_1,A\_2)

Any explanation is welcome

---

<div class="post-metadata">

**Author:** ![jaime.bosque](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/jaime.bosque/32/42220_2.png) [@jaime.bosque](https://community.dhis2.org/u/jaime.bosque)\
**Post date:** [29 April 2021 08:23 UTC](https://community.dhis2.org/t/assign-value-pr-not-working-as-expected/42373/2 "2021-04-29T08:23:02Z")

</div>

What evaluation are you using on your Program Rule?

---

<div class="post-metadata">

**Author:** ![hernandezmachava](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/h/34f0e0/32.png) [@hernandezmachava](https://community.dhis2.org/u/hernandezmachava)\
**Post date:** [29 April 2021 09:01 UTC](https://community.dhis2.org/t/assign-value-pr-not-working-as-expected/42373/3 "2021-04-29T09:01:30Z")

</div>

Hi @jaime.bosque,

I capture data da recepcao do cartao as an attribute of date data type and I assign to a data element Data da recepcao do cartao

In the program rule expression I have  
d2:hasValue (data da recepcao do cartao)

PR action  
Assign value to data element Data da recepcao do cartao

Thanks
