Using an import mapping parameter to find existing mendix object

Hello, I am trying to use a parameter in an import mapping. I can use it to set as a parent object, but I also need to be able to set it as a microflow argument to lookup an existing mendix object (as I need a composite key of operating company and registration number and I cannot only set direct attributes as keys), see screenshot.   So far I worked around by copying web service results in non-persistent entities first and then manually find existing items and then simply copy all attributes in a custom microflow. However this seems to slow things down with huge datasets (even leading to out of memory errors). Could you add the possibility to set the parameter in the lookup microflow or allow also associations to be selected as a key?
2 answers

You can modify the passed object in the "call a microflow" by setting the assocation.


My approach to achieve this was:

1) Create import via mapping of parent (using a key if you like). Use the list in your flow (e.g. ParentList). (Not included in the picture!)

2) Create import via mapping of the children: create new objects (do NOT find by key). Use the list in your flow (e.g. ChildList).

3) Iterate over ParentList. Within this iteration, iterate over ChildList. Within this double iterator, do a 'RetrieveOrCreate' based on your Parent and any key of your child you like.

4) After the RetrieveOrCreate, change the retrieved/created child by setting the values from the iteratorChild.

5) Commit the RetrievedOrCreated items. They the children that are unique to a parent and perhaps a key you have defined in your RetrieveOrCreate flow.

6) Delete the ChildList from Step 2). This makes sure only children are created which refer to a parent.


Hope this helps!