I looked into the example of the dex:: library and I tried the DataExchange example. However I still have trouble to get started in my own program. I want to read a JSON file like given in the attachment and use the data in some variables in my AIMMS program.
Could someone help me with a simple example program?
Best answer by MarcelRoelofsView original
Here’s an example that reads this input.json with the provided mapping.xml file. See MainExecution in the project.
May I ask what specifically wasn’t clear to you? Was it the identifier b, or how to actually read / write data after creating the mappings ?
Thanks for the quick response. I fact I had different issues:
I think you’re looking for something like this:
This works together with the following declarations in your model:
I tested this to work properly with your given input json file, and writing back the data will generate the same json file.
The entries for the “force-dense” attribute are there to make sure that output is also generated when the corresponding identifiers hold default values. They are of no consequence when reading the data.
Thanks a lot for this complete answer. It works and it gives me examples for some structures to build that were not explicitly mentioned in the examples.
Looking back at the example, I think my struggle was on the "iterative-reset” and "iterative-binds-to”