Assign value to a tracked entity attribute with an option set

Hello,

Using program rules, can I assign value to a tracked entity attribute with an option set?

In other words, I want the answer option selected for my tracked entity attribute to be dependent on a data element in the current stage.

I have a YES_Only data element called “Recommendation progressed at law stage?”. If this data element is ticked off I want my tracked entity attribute to be assigned with ‘Law’ answer option.

This is the rule I have built, that does not seem to be working.

**1) ** Expression - “Recommendation progressed at law stage?” == 1

**2) ** Assign value – Stage == ‘Law’

Can anyone tell me what is the correct expression to compose, (if values can be assigned to data elements with option sets at all)?

Thanks a lot,

Georgi

Georgi Chakarov, CIA | georgi@logicaloutcomes.net | +1-647-478-5634 x 104 | LogicalOutcomes c/o Centre for Social Innovation, 720 Bathurst Street, Toronto Canada M5S 2R4 | * You may unsubscribe from receiving commercial electronic messages from LogicalOutcomes by emailing *info@logicaloutcomes.net

Hi there Gorgi!

You mention a "Yes only" data element, but did you mean a "Yes only" tracked entity attribute? Meaning, is the checkbox and the dropdown both located inside same registration/profile form?

If they are, you can make a rule in the way you describe below. The correct expression would be:
A{recLawStage} == true
(Assuming you make a program rule variable called recLawStage for the "Yes only" question)

Best regards,
Markus

···

25. aug. 2017 kl. 14.03 skrev Georgi Chakarov <georgi@logicaloutcomes.net>:

Hello,

Using program rules, can I assign value to a tracked entity attribute with an option set?
In other words, I want the answer option selected for my tracked entity attribute to be dependent on a data element in the current stage.

I have a YES_Only data element called “Recommendation progressed at law stage?”. If this data element is ticked off I want my tracked entity attribute to be assigned with ‘Law’ answer option.
This is the rule I have built, that does not seem to be working.

1) Expression - “Recommendation progressed at law stage?” == 1

<image001.jpg>

2) Assign value – Stage == ‘Law’

<image002.jpg>

Can anyone tell me what is the correct expression to compose, (if values can be assigned to data elements with option sets at all)?

Thanks a lot,

Georgi

Georgi Chakarov, CIA | georgi@logicaloutcomes.net <mailto:georgi@logicaloutcomes.net> | +1-647-478-5634 x 104 | LogicalOutcomes c/o Centre for Social Innovation, 720 Bathurst Street, Toronto Canada M5S 2R4 | You may unsubscribe from receiving commercial electronic messages from LogicalOutcomes by emailing info@logicaloutcomes.net <mailto:info@logicaloutcomes.net>

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net <mailto:dhis2-users@lists.launchpad.net>
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp

Hi Markus,

I do mean a “Yes only” data element, not attribute. Basically, at data entry if the data element is ticked off I want a program rule to automatically assign value to a tracked entity attribute (which is an option set). Do you think this is possible and what would be the correct expression for assigning the value?

On another note, “Yes only” data elements work with both “1” and “true” in expressions.

Thanks for your input!

Georgi

···

From: Markus Bekken [mailto:markus@dhis2.org]

Sent: Monday, August 28, 2017 11:05 AM

To: Georgi Chakarov georgi@logicaloutcomes.net

Cc: DHIS Users dhis2-users@lists.launchpad.net; DHIS 2 Developers list dhis2-devs@lists.launchpad.net

Subject: Re: [Dhis2-users] Assign value to a tracked entity attribute with an option set

Hi there Gorgi!

You mention a “Yes only” data element, but did you mean a “Yes only” tracked entity attribute? Meaning, is the checkbox and the dropdown both located inside same registration/profile form?

If they are, you can make a rule in the way you describe below. The correct expression would be:

A{recLawStage} == true

(Assuming you make a program rule variable called recLawStage for the “Yes only” question)

Best regards,

Markus

  1. aug. 2017 kl. 14.03 skrev Georgi Chakarov georgi@logicaloutcomes.net:

Hello,

Using program rules, can I assign value to a tracked entity attribute with an option set?

In other words, I want the answer option selected for my tracked entity attribute to be dependent on a data element in the current stage.

I have a YES_Only data element called “Recommendation progressed at law stage?”. If this data element is ticked off I want my tracked entity attribute to be assigned with ‘Law’ answer option.

This is the rule I have built, that does not seem to be working.

1) ** Expression - “Recommendation progressed at law stage?” == 1**

<image001.jpg>

2) ** Assign value – Stage == ‘Law’**

<image002.jpg>

Can anyone tell me what is the correct expression to compose, (if values can be assigned to data elements with option sets at all)?

Thanks a lot,

Georgi

Georgi Chakarov, CIA | georgi@logicaloutcomes.net | +1-647-478-5634 x 104 | LogicalOutcomes c/o Centre for Social Innovation, 720 Bathurst Street, Toronto Canada M5S 2R4 | * You may unsubscribe from receiving commercial electronic messages from LogicalOutcomes by emailing *info@logicaloutcomes.net


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Ok, that makes it a bit more tricky. You probably want to assign and save tracked entity instance attributes while filling in data in an event. The problem with this is that the assignments to tracked entity attributes will be triggered when you are in the registration form, or if you open the edit profile widget - but generally not when you enter data in program stages.

There has been a few requests to allow assigning TEI attributes from everywhere in the program, and we can conceivably support this properly. Please consider creating a Jira issue describing your use case.

Is it a possible workaround to make program indicators that would query both the data element and the tracked entity attribute?

Markus

···

28. aug. 2017 kl. 13.26 skrev Georgi Chakarov <georgi@logicaloutcomes.net>:

Hi Markus,

I do mean a “Yes only” data element, not attribute. Basically, at data entry if the data element is ticked off I want a program rule to automatically assign value to a tracked entity attribute (which is an option set). Do you think this is possible and what would be the correct expression for assigning the value?

On another note, “Yes only” data elements work with both “1” and “true” in expressions.

Thanks for your input!

Georgi

From: Markus Bekken [mailto:markus@dhis2.org]
Sent: Monday, August 28, 2017 11:05 AM
To: Georgi Chakarov <georgi@logicaloutcomes.net>
Cc: DHIS Users <dhis2-users@lists.launchpad.net>; DHIS 2 Developers list <dhis2-devs@lists.launchpad.net>
Subject: Re: [Dhis2-users] Assign value to a tracked entity attribute with an option set

Hi there Gorgi!

You mention a "Yes only" data element, but did you mean a "Yes only" tracked entity attribute? Meaning, is the checkbox and the dropdown both located inside same registration/profile form?

If they are, you can make a rule in the way you describe below. The correct expression would be:
A{recLawStage} == true
(Assuming you make a program rule variable called recLawStage for the "Yes only" question)

Best regards,
Markus

25. aug. 2017 kl. 14.03 skrev Georgi Chakarov <georgi@logicaloutcomes.net <mailto:georgi@logicaloutcomes.net>>:

Hello,

Using program rules, can I assign value to a tracked entity attribute with an option set?
In other words, I want the answer option selected for my tracked entity attribute to be dependent on a data element in the current stage.

I have a YES_Only data element called “Recommendation progressed at law stage?”. If this data element is ticked off I want my tracked entity attribute to be assigned with ‘Law’ answer option.
This is the rule I have built, that does not seem to be working.

1) Expression - “Recommendation progressed at law stage?” == 1

<image001.jpg>

2) Assign value – Stage == ‘Law’

<image002.jpg>

Can anyone tell me what is the correct expression to compose, (if values can be assigned to data elements with option sets at all)?

Thanks a lot,

Georgi

Georgi Chakarov, CIA | georgi@logicaloutcomes.net <mailto:georgi@logicaloutcomes.net> | +1-647-478-5634 x 104 | LogicalOutcomes c/o Centre for Social Innovation, 720 Bathurst Street, Toronto Canada M5S 2R4 | You may unsubscribe from receiving commercial electronic messages from LogicalOutcomes by emailing info@logicaloutcomes.net <mailto:info@logicaloutcomes.net>

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net <mailto:dhis2-users@lists.launchpad.net>
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp

Thanks for this explanation, Markus! It will definitely be useful to be able to assign TE attribute values from within data entry. I will report this issue in JIRA.

For program indicators, my workaround will be to use only tracked entity attributes for calculation. I have created program rules that will warn data entry people to change the attribute value using the name of the stage at which the entity is at. The rules will be ran, based on the response of a data element at data entry.

Thanks again for your thoughts!

Georgi

···

From: Markus Bekken [mailto:markus@dhis2.org]

Sent: Monday, August 28, 2017 2:43 PM

To: Georgi Chakarov georgi@logicaloutcomes.net

Cc: DHIS Users dhis2-users@lists.launchpad.net; DHIS 2 Developers list dhis2-devs@lists.launchpad.net

Subject: Re: [Dhis2-users] Assign value to a tracked entity attribute with an option set

Ok, that makes it a bit more tricky. You probably want to assign and save tracked entity instance attributes while filling in data in an event. The problem with this is that the assignments to tracked entity attributes will be triggered when you are in the registration form, or if you open the edit profile widget - but generally not when you enter data in program stages.

There has been a few requests to allow assigning TEI attributes from everywhere in the program, and we can conceivably support this properly. Please consider creating a Jira issue describing your use case.

Is it a possible workaround to make program indicators that would query both the data element and the tracked entity attribute?

Markus

  1. aug. 2017 kl. 13.26 skrev Georgi Chakarov georgi@logicaloutcomes.net:

Hi Markus,

I do mean a “Yes only” data element, not attribute. Basically, at data entry if the data element is ticked off I want a program rule to automatically assign value to a tracked entity attribute (which is an option set). Do you think this is possible and what would be the correct expression for assigning the value?

On another note, “Yes only” data elements work with both “1” and “true” in expressions.

Thanks for your input!

Georgi

From: Markus Bekken [mailto:markus@dhis2.org]

Sent: Monday, August 28, 2017 11:05 AM

To: Georgi Chakarov georgi@logicaloutcomes.net

Cc: DHIS Users dhis2-users@lists.launchpad.net; DHIS 2 Developers list dhis2-devs@lists.launchpad.net

Subject: Re: [Dhis2-users] Assign value to a tracked entity attribute with an option set

Hi there Gorgi!

You mention a “Yes only” data element, but did you mean a “Yes only” tracked entity attribute? Meaning, is the checkbox and the dropdown both located inside same registration/profile form?

If they are, you can make a rule in the way you describe below. The correct expression would be:

A{recLawStage} == true

(Assuming you make a program rule variable called recLawStage for the “Yes only” question)

Best regards,

Markus

  1. aug. 2017 kl. 14.03 skrev Georgi Chakarov georgi@logicaloutcomes.net:

Hello,

Using program rules, can I assign value to a tracked entity attribute with an option set?

In other words, I want the answer option selected for my tracked entity attribute to be dependent on a data element in the current stage.

I have a YES_Only data element called “Recommendation progressed at law stage?”. If this data element is ticked off I want my tracked entity attribute to be assigned with ‘Law’ answer option.

This is the rule I have built, that does not seem to be working.

1) ** Expression - “Recommendation progressed at law stage?” == 1**

<image001.jpg>

2) ** Assign value – Stage == ‘Law’**

<image002.jpg>

Can anyone tell me what is the correct expression to compose, (if values can be assigned to data elements with option sets at all)?

Thanks a lot,

Georgi

Georgi Chakarov, CIA | georgi@logicaloutcomes.net | +1-647-478-5634 x 104 | LogicalOutcomes c/o Centre for Social Innovation, 720 Bathurst Street, Toronto Canada M5S 2R4 | * You may unsubscribe from receiving commercial electronic messages from LogicalOutcomes by emailing *info@logicaloutcomes.net


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Hello All,

Just following up on this issue. Are we now able take value(s) from a program stage data element and assign to a TE attribute ? Tried on 2.37.7.1 and its not working?
@Markus @dhis2-platform @dhis2-tracker @tracker-programRules

Thanks

Hi @antony.sibanda

Just to be clear, this is actually a feature request not a bug. The feature request ticket has been created here ([DHIS2-11025] - Jira) and it has 9 votes so you are welcome to add your vote there.

I don’t it’s possible yet as explained by @Markus and @brian in the previous posts linked to this topic discussion. However, if you’d like to add and explain the use case from your side it helps implement in supporting the implementation of this feature or maybe there would be another way to approach this issue. Without requiring to actually assign a TE attribute from a data element in a program stage; for instance, Markus mentioned the use of program indicators above and maybe your use case could instead make use of the program indicators.

Thanks!