Update person attributes without losing changes in xform registration

Application Name: Platform Version Number: 2.1.2

Question: Hi All, I have recently created several new Person Attributes and I can see it in the Xform Registration when I do a refresh. But unfortunately, it seems that my changes to the xform are lost everytime I do this. Is there any way to preserve my changes and also refresh changes to Person Attributes? Thanks!

What kind of changes are getting lost? Can you give an example?

For example, suppose I am working on my xform and I have added some attributes to the designer and changed some of the display text for them. Now I create a new person attribute that I would like to add to the same registration xform. I’ve done this and I refresh the left-hand panel so that the list of attributes now contains the new one that I have just created. This is great, but unfortunately, all of the other attributes for which I have previously modified the display text and menu type (ie single select or text, etc) also get reset to the original values and my changes are now lost. Perhaps I am doing this all wrong and this isn’t the proper way to add a new attribute? Thanks!

Are you able to reproduce this here such that i take a look? modules-refapp.openmrs.org

Hi Daniel, I can’t log into your link. Here are the steps that I am taking:

  1. I create a new person attribute called “favourite movie”.
  2. I go to my registration xform and I refresh my form fields.
  3. My new attribute “favourite movie” now appears in the form fields. I select it and I change the properties so that the Type is changed from the default Single Select to Text.
  4. I save my changes and I exit the registration xform.
  5. I create another new person attribute called “favourite food”.
  6. I go to my registration xform and I refresh my form fields.
  7. My new attribute “favourite food” now appears in the form fields. I select it and I change the properties so that the Type is changed from the default Single Select to Text.
  8. I now click on my previously created attribute called “favourite movie” and I see that the Type has now changed back to the default Single Select.

It seems as though everytime I add a new attribute and refresh my form fields, all of the changes that I have previously made to my other new attributes are now removed. And I end up having to make all of my changes again. I’m sure that I am doing something wrong.

Can you try this server again? modules-refapp.openmrs.org/openmrs/

Hi Daniel, sorry, I can’t log in. Should I be using my openmrs credentials? Do you want to reset my password, maybe?

I sent you login information in a private message.

Thanks Daniel. I am now able to log in. There is an error in the current Patient Xform Design, however. I am getting this error when I try to open it: (TypeError): Cannot read property ‘i’ of null So I am unable to show you what I am doing. Thanks

Use Firefox.

Hi Daniel, Sorry for the delay. I was able to log in and “partially” reproduce the problem. Here’s what I did in detail:

  1. I created two new concepts: anne_test1 (concept id=163140) and anne_test2 (concept id=163141).
  2. I created one new person attribute called anne_test1 that uses concept anne_test1.
  3. I went to the Patient XForm Designer and immediately, I saw anne_test1 in the Form Fields panel (without having to refresh it). In my own application, I refresh was necessary.
  4. By default, the properties for this attribute has Type=“Single Select”. I change Type=“Text”; Required=“True”; Default Value=“test”.
  5. I saved my changes and exited the designer.
  6. I created another new person attribute called anne_test2 that uses concept anne_test2.
  7. I went to the Patient XForm Designer and I don’t see anne_test2, so I refresh the Form Fields panel in order to see it.
  8. I now see anne_test2 with the default values (this is expected). But what I notice now is that anne_test1’s properties have lost some of my changes: Type has now been changed back to the default “Single Select”, but Required is still “True” and Default Value is still “test”. In my own app, when I reach this step, ALL of my changes would be lost (ie Type=“Single Select”; Required=“False”; Default Value=null).
  9. I haven’t modified anne_test2 properties, so the default values remain, in case you want to compare it to anne_test1 where only some changes are kept.

Hope this helps! Thanks

What is the format of your person attribute type? I mean the format on this screen https://demo.openmrs.org/openmrs/admin/person/personAttributeType.form?personAttributeTypeId=2

Hi Daniel,

I am unable to log in using the credentials that you have previously sent me. But here is an example from my own app (including attribute as well as concept def).

Thanks

Can you change the format to “java.lang.String”?

I could, but what about for other attributes that are of Datatype=Coded, for example? The problem exists no matter what the datatype is.