← Back to team overview

dhis2-devs team mailing list archive

Re: TrackedEntityAttribute update - add optionSet

 

Ok, I will need to look more into it then, it should have worked with
mergeStrategy=REPLACE

--
Morten

On Fri, Jun 19, 2015 at 11:26 AM, Alan Hill <ahill@xxxxxxxxxx> wrote:

> Hi Morten
>
> Many thanks for the response.
>
> Yes, remove the OptionSet assignment from the TrackedEntityAttribute.
>
> I have tried as suggested with the following JSON and it does not remove
> the assignment:
>
> {
> "id":"z4fdyQtgja3",
> "created":"2015-06-18T22:28:48.352+0000",
> "name":"DHS 2010 - Median month of interview",
> "href":"http://localhost:8000/api/trackedEntityAttributes/z4fdyQtgja3";,
> "lastUpdated":"2015-06-19T04:20:31.641+0000",
> "code":"DHS 2010 - inter_month",
> "shortName":"DHS 2010 - Median month of interview",
> "displayDescription":"Median month of interview",
> "unique":false,
> "programScope":false,
> "displayInListNoProgram":false,
> "orgunitScope":false,
> "displayOnVisitSchedule":false,
> "dataDimension":true,
> "description":"Median month of interview",
> "externalAccess":false,
> "valueType":"int",
> "confidential":false,
> "publicAccess":"rw------",
> "allItems":false,
> "inherit":false,
> "dimension":"z4fdyQtgja3",
> *"optionSetValue":false,*
> "displayName":"DHS 2010 - Median month of interview",
> "displayShortName":"DHS 2010 - Median month of interview",
> *"optionSet":null,*
> "name":"DHS 2010 - Median month of interview",
> "code":"DHS 2010 - inter_month",
> "created":"2015-06-18T22:28:48.253+0000",
> "lastUpdated":"2015-06-18T23:52:01.383+0000",
> "href":"http://localhost:8000/api/optionSets/X61RbMAvsTj"},
> "access":{"update":true,
> "externalize":false,
> "write":true,
> "delete":true,
> "read":true,
> "manage":true},
> "user":{"id":"M4XhsWJlIhk",
> "name":"admin admin",
> "created":"2015-06-18T15:26:06.062+0000",
> "lastUpdated":"2015-06-18T16:07:29.473+0000",
> "href":"http://localhost:8000/api/users/M4XhsWJlIhk"},
> "attributeValues":[],
> "items":[],
> "userGroupAccesses":[]
> }
>
> Note also that updating through the UI, i.e. change from optionSet ->
> number, the optionSet still appears on the form when reloading.
>
> Many thanks
>
> Alan
>
>
> On Thu, Jun 18, 2015 at 6:52 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
> wrote:
>
>> So you want to clear out the optionset completely? try and set it over as
>> optionSet: null, and set merge strategy to REPLACE
>>
>> --
>> Morten
>>
>> On Thu, Jun 18, 2015 at 10:17 PM, Alan Hill <ahill@xxxxxxxxxx> wrote:
>>
>>> Hi Morten
>>>
>>> I have tried this with trunk (build # 19453) and assigning the
>>> optionSet now seems to function correctly.
>>>
>>> However, removing the optionSet is still not possible.
>>>
>>> Should I be using any specific strategy / mergeStrategy for the remove
>>> to function?
>>>
>>> Many thanks for the quick turn around.
>>>
>>> Alan
>>>
>>>
>>>
>>> On Wed, Jun 17, 2015 at 6:39 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
>>> wrote:
>>>
>>>> Hi
>>>>
>>>> Please try again with the latest version of 2.19 or trunk.
>>>>
>>>> --
>>>> Morten
>>>>
>>>> On Thu, Jun 18, 2015 at 1:22 AM, Alan Hill <ahill@xxxxxxxxxx> wrote:
>>>>
>>>>> Hi there
>>>>>
>>>>> I have a TrackedEntityAttribute created through the web api and want
>>>>> to perform an update to both add and remove an optionSet assignment.
>>>>>
>>>>> I have attempted to do this using a PUT, supplying the JSON previously
>>>>> retrieved via a GET and adding/remove the option set and setting the
>>>>> valueType accordingly.
>>>>>
>>>>> Here are the relevant JSON fields:
>>>>>
>>>>> *Assign*
>>>>>
>>>>> ...
>>>>> valueType: "optionSet",
>>>>> optionSet: {id: "<id>"},
>>>>> optionSetValue: true,
>>>>> ...
>>>>>
>>>>> *Remove*
>>>>>
>>>>> ...
>>>>> valueType: "number",
>>>>> optionSetValue: false,
>>>>> ...
>>>>>
>>>>>
>>>>> However, this seems to make no difference to the attribute.
>>>>>
>>>>> If I try through the UI to change an attribute valueType from
>>>>> optionSet -> number, it still has the optionSet assignment so perhaps this
>>>>> is not possible...?
>>>>>
>>>>> Any advice greatly appreciated.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Alan
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>
>>>>>
>>>>
>>>
>>
>

Follow ups

References