Generate automatic

Hi community,

I create a code attribute that dhis2 can generate automatically. The problem is that there are already records in dhis2 before this code is inserted. How to automatically generate these attributes to not change one by one the list…

Thank you


@Gassim

Hi @crakotondramanitra

Please clarify further. Thanks!

Hi @Gassim ,

I created a tracker program to track an activity. I put as attribute last name, first name, sex. We have already entered data into the program, after we found that there is a lot of the same name. Then we put a code in the attribute that is generated automatically. I want the data entered before the implementation of the code to be completed automatically (the code) instead of manually generating it one by one

image

Thanks a lot

1 Like

Hi @crakotondramanitra

In order to update the value of the code attribute for TEIs that were captured before you implemented the code, you may need to:

  1. Pull all TEIs via serverURL/api/tracker/trackedEntities.json?fields=*

For Each TEI:

  • Get the values of the attributes that you use to calculate the code

  • Use the values to calculate the code

  • Set the value of the code attribute to the calculated value and make a PUT request

1 Like