How to use the same data element in different stages within the same program

Hi community,

I have setup a program that contains 2 stages: Prevention and Traitment. I have a data element called “Date of testing” that is entered in the ‘Prevention’. In the Traitment stage I want again to display the data element “Date of testing” if it has been already provided. if Not the field remaind empty and I can enter the value during the Traitment stage.
I have tried to use program rule with the concept of source type Data element from the newest event in the current program but I dont get it clearly.
I have assigned the variable “Date of testing” in the two stage.
I have create a program variable with source type :Data element from the newest event in the current program.
I am a little bit confused on the way of setting up the program rule.
Could some one help me with the good approach, step or example to do it.

Thanks

3 Likes

Hello @Gerard_Bisama,

I am experiencing similar case but instead of date I am using option sets, and other dependent values.

I have created a program variables and rule but in condition section I am confused how to call values if it changed from other programs because the first assigned value is only considered

Please advise

BR,
Ayman

3 Likes

Hello @ayman.tuffaha,

Finally to solve the probleme, I have decided to define “date of testing” data element for each stage.
To get the date of testing of the prevention stage I have define a program rule variable with source type “Data element from the newest event in the current program”. The I have define program rule for the traitement stage when I assign the date of testing variable to the data element date of testing of the stage traitement. On additional thing to take into account is that this assignment does not work when the page is loaded, so you must define in the program rule an expression that will trigger the assignment, in my case when I select a orgunit on the traitement stage.
This is how I have solved the problem.
I hope that it may help you.

2 Likes

Hi @Gerard_Bisama,

I have a problem I think you can help me,

I capture data da recepcao do cartao as an attribute of date type and I assign it to a data element Data da recepcao do cartao(I have given the DE the same as the attribute) in the program stage. But the Program rule does not seem to be triggered automatically.

Steps I have taken:
Program rule variable
image

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

Program rule expression

Program rule action

So how do have defined defined in the program rule an expression that triggers the assignment?

Thanks