Location Attribute errors in DHIS2 Reporting Module 2.0

Application Name: OpenMRS Version Number: 1.9.9

Question: Hi, we are trying to implement the DHIS Reporting Module. We are coming up against an immediate issues that we can’t figure out from the documentation.

When we we try to map the Location codes from DHIS2 as Location attributes in OpenMRS, we get the error:
could not insert: [org.openmrs.LocationAttribute]

We don’t get the error if we create a new location in OpenMRS, suggesting that this is conflict issue with prior existing Location Attributes.

Do you mind sharing the full stack trace at pastebin.com?

we have done that before without any issues. how are u persisting or managing the location attributes (codes) for each location? in our case we used metadatadeploy module

Here is the link to the full stack trace. Please let me know if you have issues accessing this.

<script src=“https://pastebin.com/embed_js/rCcs3cjp”></script>

Currently we are not using a module to manage or persist location attributes (codes) for each location. We are only using the core that OpenMRS provides.

If i wanted to reproduce this locally, do you have a list of the steps?

Steps include:

  • add location
  • save location without a CODE
  • open created location and try to add CODE
  • save location
  • internal error results

*Error results when we want to modify old locations and add CODES to those.

Are you able to reproduce that here? http://demo.openmrs.org

With what information do I log in?

UserName: admin

Password: Admin123

We created a location attribute, name “CODE”. That worked fine.

Then, we created a new location, name “chuti estancia” without a Code. This also worked fine. However, when we added a Code, name “Solola” after saving everything except the Code was saved. We tried again with a different Code name (“Comalapa”) and Description (“location test”). When saving this, everything except the Code was saved again.

Please let us know if this has been a common issue. Thank you.

Doesn’t this location have a saved CODE? https://demo.openmrs.org/openmrs/admin/locations/location.form?locationId=10

From the link you shared, there is no saved information. What do you mean?

You probably checked after the demo server was reset. Can you reproduce it from here? https://uat-refapp.openmrs.org

We tried again and did not work. This is what we did:

We created a location attribute, name “CODE”. That worked fine. Then, we created a new location, name “tecpan” without a Code. This also worked fine. However, when we added a Code, name “chimaltenango” after saving everything except the Code was saved.

Is that on uat-refapp.openmrs.org?

Yes that was on the link you sent.

Can you take a look at this and tell me if it has the CODE named ‘chimaltenango’ https://uat-refapp.openmrs.org/openmrs/admin/locations/location.form?locationId=9

I think the session timed out, so we re-did the steps. I have attached screen shots of our steps:

![location%20-%20also%202nd%20step%20|690x811]

After adding the Code “Chimaltenango” to this location, we saved and returned to view this location. However, the Code “Chimaltenango” was no longer visible.

(upload://1LTD953bMMH060aUnB9Kb5pmEjm.png)

Between each of these steps Open said “Location saved” .

I thought you were using the legacyui interface like the url i sent.