How to keep the order of enumeration when updating a property with REST API
I have been able to use the REST API to update attributes in work items. So far this method is working fine
<url-of-workitem>?x-oslc-cm-change-request%2Bjson&oslc_cm.properties=rtc_cm:Fixed_Versions_EL
and I pass a json object { "Fixed_Versions_EL": [ "1.0", "1.1", "1.2"] }
This is working for all attributes, but I do have an issue with a field that is of type Enumeration List. In that case the order that I commit is not the one I see in the work item. For example the above request will show up as 1.1 , 1.0, 1.2 which is correct but not what I expected..
Is there a way to prevent this, how can I keep the order. ( our server is running 5.0.2 ifix012 )
<url-of-workitem>?x-oslc-cm-change-request%2Bjson&oslc_cm.properties=rtc_cm:Fixed_Versions_EL
and I pass a json object { "Fixed_Versions_EL": [ "1.0", "1.1", "1.2"] }
This is working for all attributes, but I do have an issue with a field that is of type Enumeration List. In that case the order that I commit is not the one I see in the work item. For example the above request will show up as 1.1 , 1.0, 1.2 which is correct but not what I expected..
Is there a way to prevent this, how can I keep the order. ( our server is running 5.0.2 ifix012 )
Comments
Donald Nong
Mar 13 '16, 8:26 p.m.Enumeration list does not have an "order" if I understand correctly. It may well be how the values are presented, rather than how they are updated. What's the attribute presentation in the work item editor? How does it actually look?
A screenshot may help a lot but you have to attach it somewhere else due to your low reputation.
Alain robert
Mar 13 '16, 11:57 p.m.Thanks for getting back to me
so this is what I get when i post the change 8.8, 8.7, 8.6, from highest to lowest
The editor is defined like that
If I use the web editor, I am able to add each value in the order I want and this order is kept when i reopen a work item. I wish I could reproduce that when I edit with the REST api.
Alain robert
Mar 20 '16, 3:40 a.m.any suggestion?
Donald Nong
Apr 20 '16, 9:54 p.m.What I found is that when using OSLC API, the enumeration list order appears to be the same as the IDs (smaller number first). It may be that the code actually does sort the enumerations first before updating. I have found no way to carry the order in the presentation.