Hi Chaiwa,
I’ve tested the fetchData function using this expression and this state:
fetchData(
{ fields: {
"dataSet": 'pBOMPrpg1QX',
"orgUnit": 'DiszpKrYNg8',
"period": '201711'
}}
)
{
"data": {},
"configuration": {
"username": "admin",
"password": "district",
"apiUrl": "[https://play.dhis2.org/demo](https://play.dhis2.org/demo)"
}
}
As you can see, I’m using the test account for DHIS2. I get this result when I run it:
Getting Data Value Sets:
Get Result: { dataSet: 'pBOMPrpg1QX',
period: '201711',
orgUnit: 'DiszpKrYNg8',
dataValues:
[ { dataElement: 'Ix2HsbDMLea',
period: '201711',
orgUnit: 'DiszpKrYNg8',
categoryOptionCombo: 'bRowv6yZOF2',
attributeOptionCombo: 'bRowv6yZOF2',
value: '2',
storedBy: 'system',
created: '2014-02-27T06:43:18.659+0000',
lastUpdated: '2014-02-27T06:43:18.659+0000',
followUp: false },
{ dataElement: 'MSZuQ1mTsia',
period: '201711',
orgUnit: 'DiszpKrYNg8',
categoryOptionCombo: 'bRowv6yZOF2',
attributeOptionCombo: 'bRowv6yZOF2',
value: '5',
storedBy: 'system',
created: '2014-01-28T00:16:26.887+0000',
lastUpdated: '2014-01-28T00:16:26.887+0000',
followUp: false },
{ dataElement: 'r6nrJANOqMw',
period: '201711',
orgUnit: 'DiszpKrYNg8',
categoryOptionCombo: 'bRowv6yZOF2',
attributeOptionCombo: 'bRowv6yZOF2',
value: '7',
storedBy: 'system',
created: '2014-01-28T00:16:25.438+0000',
lastUpdated: '2014-01-28T00:16:25.438+0000',
followUp: false },
{ dataElement: 'eY5ehpbEsB7',
period: '201711',
orgUnit: 'DiszpKrYNg8',
categoryOptionCombo: 'bRowv6yZOF2',
attributeOptionCombo: 'bRowv6yZOF2',
value: '2',
storedBy: 'system',
created: '2014-02-27T06:43:18.184+0000',
lastUpdated: '2014-02-27T06:43:18.184+0000',
followUp: false },
{ dataElement: 'NpJtsQkMTm3',
period: '201711',
orgUnit: 'DiszpKrYNg8',
categoryOptionCombo: 'bRowv6yZOF2',
attributeOptionCombo: 'bRowv6yZOF2',
value: '6',
storedBy: 'system',
created: '2014-01-28T00:16:25.158+0000',
lastUpdated: '2014-01-28T00:16:25.158+0000',
followUp: false },
{ dataElement: 'f7n9E0hX8qk',
period: '201711',
orgUnit: 'DiszpKrYNg8',
categoryOptionCombo: 'bRowv6yZOF2',
attributeOptionCombo: 'bRowv6yZOF2',
value: '6',
storedBy: 'system',
created: '2014-01-28T00:16:25.983+0000',
lastUpdated: '2014-01-28T00:16:25.983+0000',
followUp: false },
{ dataElement: 'lXolhoWewYH',
period: '201711',
orgUnit: 'DiszpKrYNg8',
categoryOptionCombo: 'bRowv6yZOF2',
attributeOptionCombo: 'bRowv6yZOF2',
value: '5',
storedBy: 'system',
created: '2014-01-28T00:16:26.415+0000',
lastUpdated: '2014-01-28T00:16:26.415+0000',
followUp: false } ] }
I get a full set of dataValues. However, when I tried a value of 201601 for period, I got your same results. So maybe you have to check that you fetch dataValues for other periods that has data attached to it.
Hope this info will be helpful for you. Let us know how this goes for you.
Bests,
Santiago