So we finally found out was was causing the issue: the use of inheritence messes with the IDs. That in combination with the ID sorting was causing the problem we experienced.
The issue was mentioned somewhere on the restServices github page. I'll make sure to file a formal bugreport for this.
Thanks for all your input!
Hi Nick and Chris,
First of all, thank you for your answers. I'll try to give an as complete answer as possible.
We actually don't use a sorting attribute. How would we do that, using the JSON serializer? The easiest way to show you is by modelshare. Brief explanation:
The user is able to select what the timeframe is for the graph (day, week, month, year). This is known as Filter. Based on the filter the data is later aggregated to the correct timeframe. After all the data is collected it is added ( through assocation) to the highest entity, and that is passed to the JSON Serializer.
So the actual problem is that the JSON serializer mixes up the columns, where the X-axis becomes the Y-axis and vice versa. We have one database (local) which works correctly, and another database (cloud backup) which doesn't. That's why we think it's an ID issue. Howver, we don't actually supply an ID, so how would we use that ID as a string and tell the JSON Serializer to use that one instead of the Int?
https://modelshare.mendix.com/models/7b296be2-4424-435e-a842-5d100d6c1e1b/populategooglecolumnchart
<iframe width="100%" height="491px" frameborder="0" src="https://modelshare.mendix.com/models/7b296be2-4424-435e-a842-5d100d6c1e1b/populategooglecolumnchart?embed=true"></iframe>Hi Paul, If I have a quick look into restservices.util.JsonSerializer, I find the following;
/**
* Referenceset
*/
else if (member instanceof MendixObjectReferenceSet){
JSONArray ar = new JSONArray();
if (value != null) {
@SuppressWarnings("unchecked")
List<IMendixIdentifier> ids = (List<IMendixIdentifier>) value;
Utils.sortIdList(ids);
for(IMendixIdentifier id : ids) if (id != null) {
Object url = identifierToJSON(context, id, alreadySeen, useServiceUrls);
if (url != null)
ar.put(url);
}
}
target.put(targetMemberName, ar);
}
I'm not too sure about why the Utils.sortIdList() is used and which does what it says. Perhaps you can file an issue at GitHub
Really curious about the solution to this issue.