Copy data from non-persistent entity to a persistent one

I am using Mendix 7.0.2 and the amazing import mapping feature. However, I'm really new to Mendix and don't know how to get the data from the non-persistent entities created by the import mapping and an actual entity in the database I can do something with. I know I can also do "stuff" with the non-persistent entity's data, but I'm more interested in making the data persistent. What do you recommend?
2 answers

Is the problem getting the non-persistent enitities? If so, make sure you set an association during the import that you can leverage to retrieve them.

If the problem is what to actually do with them, assuming you want to update potentially existing data, I would do is a simple retrieve or create sub microflow. Take the non-persistent entity as a parameter, retrieve (from database) the persistent entity who matches the unique identifier [ $attribute = $nonpersistententity/attribute], create an exclusive split saying [$retrievedpersistententity = empty], on true create a new persistent entity with the values you want to copy, on false update the entity with values from non-persistent entity. Then finally pass back the persistent entity.  



You can use the import mapping to directly import your data into persistent entities.

This shows you how:

Choose 'Create an object' if you want to insert the data into your database, or choose 'Find an object (by key)' to update.