Assign a new value to an tracked entity attribute

Hello everyone.

Is it possible to assign a new value to a TEA?
So I have a program rule that assigns a value “1” to a TEA when a certain condition is true. In the next event, a different program rule needs to assign “2” to this TEA. Currently this is not working but I’ve tested the rules separately and a value can be assigned for both if the TEA had no value previously. Does anyone know how to fix this? (Summary below)

Event 1: Program Rule A assigns “1” to TEA
Event 2: Program Rule B assigns “2” to the same TEA

Thanks.

1 Like

Thanks for posting this again Clara, I’ll try to get help!

BTW, longer discussion before was here: Clearing an assigned value and assigning different value to it :sweat_smile:

Hi @Clara !

Thanks for the question!
I presume that the first program rule assigns a value to the TEA based on the data entered in another TEA.

If the second program rule is supposed to assign a value based on the other TEA value, it is possible.

However, it is not possible to assign a value to a TEA, based on the values entered in an event (program stage).

Hope this helps.

1 Like

Nope. It was actually set using values entered in a program stage and it works! What doesn’t work is assigning a new value to a TEA when it’s already set.

1 Like

Can you please specify, what DHIS2 version are you using?

If you have your first event together with the enrollment stage in the tracker dashboard, it is possible to assign a value from the event to the TEA and overwrite it if needed.
After clicking “Save and Continue”, you will not be able to reassign values to the TEA from the program stage dashboard anymore.

If the program is designed so that the enrollment happens first (Save and Continue), and then you access the program stage, it is not possible to assign values to TEAs from the program stage dashboard.

1 Like

I’m using 2.37.6. I think they’ve updated that because I have the enrollment stage, stage 1 and stage 2. And this is what is happening:

  • Stage 1: Program Rule 1 conditions evaluate to true, if TEA does not have previous assignment, TEA assigns the value “1” (tested and working).
  • Stage 2: Program Rule 2 conditions evaluate to true, if TEA does not have previous assignment, TEA assigns value “2” (tested and working).

This is what I want:

  • Stage 1: Program Rule 1 conditions evaluate to true, if TEA does not have/has previous assignment, TEA assigns the value “1”
  • Stage 2: Program Rule 2 conditions evaluate to true, if TEA does not have/has previous assignment, TEA assigns value “2”

Right Clara but I think @YuryR means to say that once a value has been assigned to the TEA (so if it has previous assignment,) “it is not possible to change the value of a TEA from the program stage dashboard.”

Ohhhh. Got it. Is there a way to make a TEA NULL or blank after it has been previously assigned?

2 Likes

(Thinking out loud)I guess another hack-fix would be to create an audit log, in essence, through multiple TEAs. Could hide them based on value, so that only one appears, as well. so something like:

If d2:hasValue(TEA1) && TEA1!=DE in PStage1, action=DE in PStage1 assigned to TEA2

and then in the enrollment–if d2:hasValue(TEA2), action=Hide TEA1
–if !(d2:hasValue(TEA2),action=Hide TEA2

Would it be possible to use Data Elements and then assign the final value to a TEA at the end of it all? It’s not very easy not knowing the use case (not the technical steps but the objective and desired result)

@Matthew_Boddie interesting!

2 Likes