Hello Gristers,
I have a question regarding the export of my whole Game design document in JSON format. Right now, I’m using the API to request the wanted doc and filter tables and columns the way I want it. I was using the hidden columns gristHelper_DisplayX to have the textual value of the referenced columns.
But I noticed that it was sometimes not returned in the right order messing up the export (swapping column values). I suppose it is because of the order I changed the type of some columns to reference.
I don’t see a way to have the proper index even when looking at columns data.
I know it is possible as the excel and csv exports return the values in the right order.
I would like to use gristHelper_Display if possible and avoid to request and cache the other tables to get the correct referenced values.
What would be the best approach?
Thanks for your help
So, I’m gonna reply my own question as I found the solution 5 mins after posting here (the famous duck effect) and it might be useful for someone.
I just needed to request the columns with the hidden parameter set to true (I didn’t see it was possible for this request as well) and the matching them using fields.displayCol and fields.colRef.
For instance:
{
"id": "LEAGUE_ID",
"fields": {
"colRef": 7,
"parentId": 2,
"parentPos": 7,
"type": "Ref:LEAGUES",
"widgetOptions": "{\"widget\":\"Reference\",\"alignment\":\"left\",\"rulesOptions\":[]}",
"isFormula": false,
"formula": "",
"label": "LEAGUE_ID",
"description": "",
"untieColIdFromLabel": false,
"summarySourceCol": 0,
"displayCol": 773,
"visibleCol": 44,
"rules": null,
"reverseCol": 0,
"recalcWhen": 0,
"recalcDeps": null
}
}
is displayed in this hidden column
{
"id": "gristHelper_Display2",
"fields": {
"colRef": 773,
"parentId": 2,
"parentPos": 773,
"type": "Any",
"widgetOptions": "",
"isFormula": true,
"formula": "$LEAGUE_ID.ID2",
"label": "gristHelper_Display2",
"description": "",
"untieColIdFromLabel": false,
"summarySourceCol": 0,
"displayCol": 0,
"visibleCol": 0,
"rules": null,
"reverseCol": 0,
"recalcWhen": 0,
"recalcDeps": null
}
}