How does form field data relate to fixture data

I’m trying to find out how a form field retrieved from the Application API is related to the fixture data API.

For example:

{
  "comment": null,
  "constraint": null,
  "group": "/data/administrative_information",
  "hashtagValue": "#form/administrative_information/project",
  "is_group": false,
  "label": "Proyecto",
  "label_ref": "administrative_information/project-label",
  "options": [],
  "relevant": null,
  "repeat": null,
  "required": true,
  "setvalue": null,
  "tag": "select1",
  "translations": {
    "en": "Project",
    "es": "Proyecto"
  },
  "type": "Select",
  "value": "/data/administrative_information/project"
},

Which field in the above json tells me that the fixture is below:

{
  "fields": {
    "project_display_text": "Water Smart Agriculture",
    "project_key_value": "water_smart_agriculture"
  },
  "fixture_type": "project",
  "id": "1234",
  "resource_uri": ""
},
{
  "fields": {
    "project_display_text": "Emergency Response",
    "project_key_value": "emergency_response"
  },
  "fixture_type": "project",
  "id": "2345",
  "resource_uri": ""
},

In the example above, it’s purely by accident that the fixture type is named project, like the field definition. It can be called something entirely different.
What links them together?

Hi all, any updates on this issue?

I think this might be a limitation of the current application structure API, unfortunately.

I’ve created a ticket on the Open Source issue tracker to track this field so that it can be linked in the future.

This is not fair :frowning:

The CommCare editor has the ability to link that data back together, which means that it's not using the API's to do that.
This should be remedied as soon as possible.

Thanks!

I wanted to let you know that this limitation issue was picked up by the Open Source community and recently resolved in the codebase.

If you are using a hosted CommCareHQ server (like https://www.commcarehq.org), this change will likely take a bit of time before it is deployed into production. My guess is that the API should start providing this data in about a week. In the future, questions with lookup tables that have data sources will contain a block like the following.

"data_source": {
  "instance_id": "long-sequence",
  "instance_ref": "jr://fixture/item-list:long-sequence",              
  "label_ref": "x",
  "nodeset": "instance('long-sequence')/long-sequence_list/long-sequence",
  "value_ref": "y"
}
1 Like

@CommCare_N00b this is now live on production if you want to take it for a spin.