Issue with custom attributes in data set api

Hi Morten,

We have created an attribute called “isPrintable” with a value type - “Yes Only” and assigned it to data set and program. We have few clarifications on the below api

/api/dataSets.json?fields=id,name,attributeValues[:all,value,name,attribute[id,name,code]]

  • Immediately after assigning the attribute to data set and program, we invoked the api. The api is not showing the attribute as part of the response as it is still ‘unchecked’ in the data set page of maintenance app. The attribute array is empty in the response.
  • Now we marked that attribute is ‘checked’ in the data set page of maintenance app. The api is returning the attribute value as ‘true’ which is fine. But when the attribute is ‘unchecked’ in the app, the api is returning the value as ‘false’. Should it not show up in the response as it was in the first case? Is it expected behaviour? If so what is the difference between “Yes Only” and “Yes No” attribute types?
  • Now we edited that attribute and unassigned it from data set and program. But the data set api is still showing the attribute in its response. It should not come up in the response right?

Could you please provide inputs for the same.

Thanks

Aamer.

Also in the second test case mentioned below.

  • Now we marked that attribute is ‘checked’ in one of the data set page of maintenance app. The api is returning the attribute value as ‘true’ which is fine. But when the attribute is ‘unchecked’ in the app, the api is returning the value as ‘false’. Should it not show up in the response as it was in the first case? Is it expected behaviour? If so what is the difference between “Yes Only” and “Yes No” attribute types?
···

The api is returning the value as ‘false’ only for the data set which we have modified. The other data sets still do not show the attribute as it was in the first case. So the api is showing two different behaviours for the same test case.

We have reproduced all of these in play demo instance itself.

Could you please provide inputs for the same.

Thanks

Aamer.

On Thu, Jul 28, 2016 at 12:06 PM, Aamer Mohammed aamerm@thoughtworks.com wrote:

Hi Morten,

We have created an attribute called “isPrintable” with a value type - “Yes Only” and assigned it to data set and program. We have few clarifications on the below api

/api/dataSets.json?fields=id,name,attributeValues[:all,value,name,attribute[id,name,code]]

  • Immediately after assigning the attribute to data set and program, we invoked the api. The api is not showing the attribute as part of the response as it is still ‘unchecked’ in the data set page of maintenance app. The attribute array is empty in the response.
  • Now we marked that attribute is ‘checked’ in the data set page of maintenance app. The api is returning the attribute value as ‘true’ which is fine. But when the attribute is ‘unchecked’ in the app, the api is returning the value as ‘false’. Should it not show up in the response as it was in the first case? Is it expected behaviour? If so what is the difference between “Yes Only” and “Yes No” attribute types?
  • Now we edited that attribute and unassigned it from data set and program. But the data set api is still showing the attribute in its response. It should not come up in the response right?

Could you please provide inputs for the same.

Thanks

Aamer.

Hi

There is no cleanup done when you un-assign an attribute, so the values will still be there.

@Mark: I guess you need to send in null, and not false for yes-only attributes, we should probably fix on the backend also

···

On Thu, Jul 28, 2016 at 8:48 AM, Aamer Mohammed aamerm@thoughtworks.com wrote:

Also in the second test case mentioned below.

  • Now we marked that attribute is ‘checked’ in one of the data set page of maintenance app. The api is returning the attribute value as ‘true’ which is fine. But when the attribute is ‘unchecked’ in the app, the api is returning the value as ‘false’. Should it not show up in the response as it was in the first case? Is it expected behaviour? If so what is the difference between “Yes Only” and “Yes No” attribute types?

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

The api is returning the value as ‘false’ only for the data set which we have modified. The other data sets still do not show the attribute as it was in the first case. So the api is showing two different behaviours for the same test case.

We have reproduced all of these in play demo instance itself.

Could you please provide inputs for the same.

Thanks

Aamer.

On Thu, Jul 28, 2016 at 12:06 PM, Aamer Mohammed aamerm@thoughtworks.com wrote:

Hi Morten,

We have created an attribute called “isPrintable” with a value type - “Yes Only” and assigned it to data set and program. We have few clarifications on the below api

/api/dataSets.json?fields=id,name,attributeValues[:all,value,name,attribute[id,name,code]]

  • Immediately after assigning the attribute to data set and program, we invoked the api. The api is not showing the attribute as part of the response as it is still ‘unchecked’ in the data set page of maintenance app. The attribute array is empty in the response.
  • Now we marked that attribute is ‘checked’ in the data set page of maintenance app. The api is returning the attribute value as ‘true’ which is fine. But when the attribute is ‘unchecked’ in the app, the api is returning the value as ‘false’. Should it not show up in the response as it was in the first case? Is it expected behaviour? If so what is the difference between “Yes Only” and “Yes No” attribute types?
  • Now we edited that attribute and unassigned it from data set and program. But the data set api is still showing the attribute in its response. It should not come up in the response right?

Could you please provide inputs for the same.

Thanks

Aamer.