I am parsing a JSON Array and creating MendixObjectReferenceSet JSONArray srcJsonArray; for(int i = 0; i < srcJsonArray.length(); i++) { Object jsonElement = srcJsonArray.get(i); IMendixObject elmentEntity = Core.instantiate(context, elementType); // Set values on elmentEntity MendixObjectReference reference = (MendixObjectReference)elmentEntity.getMember(context,memberName); reference.setValue(context, tgtEntity.getId()); } However when I later retrieve those array elements from the reference set, the order is not preserved from the JSONArray order. List<IMendixObject> arrayObjs = Core.retrieveByPath(context, tgtEntity, memberName, true); Is there a way to preserve the order as defined by the source JSON Array?
asked
Ron Marchi
1 answers
0
The order in a referenceset is not guaranteed. If you need the order as you input the data use a reference instead.