Get grouped data value from kobotoolbox

Say that the body of a message received from Kobotoolbox is similar to this one:

“__query_params”: {},
“data”: {
“_id”: 164066146,
“group_fields/code1”: “code number one”,
“group_fields/code2”: “code number two”,

I know that retrieves the value of “_id”.
But to get the value of that “g_update/code”?
Thanks in advance.

Hi @kumori, if you’re trying to access this data in an OpenFn job, you’d use bracket notation (see “property accessors”) like this:

create('thing', {
  id: dataValue(''), // the best way
  id:, // or like this
  id: state['data']['data']['_id'], // or this
  code: dataValue('data.group_fields/code1'), // the best way
  code:['group_fields/code1'] // or like this
  code:['g_update/code'], // or this

Hope that helps!


1 Like