Add Records To Associated Entities From Import

0
Hi – I’m trying to add records from a file import to associated entities. I saw this post https://community.mendix.com/link/questions/85692 that explains how to do it on an individual record basis, but in this case I need to do it from a flat file import to see if new records are imported, and if so, add records to associated entities. How can I accomplish this in a microflow, and more important, where can I trigger it (ideally via a button on my Navigation)? Example:   I am importing into an “Archive” entity from a file import For any records in “Archive” that don’t exist in associated “Accounts” entity, add records to “Accounts” entity   Thanks for any tips … I have been searching the forums and studying the tutorials but am a bit stuck. In Microsoft Access, I would do this via an “append” query. Not sure how to do this in Mendix.  
asked
2 answers
0

Hi SL,

You can do this in a microflow by retrieving all of your archive objects, using an iterator to iterate them, retrieving your associated object, and then using the change object to set the association. You can add a microflow button on a page to trigger this microflow, or you can run the logic after your flat file import. 

Here is a quick example of associating a list of objects to a single object. 

 

Here is the model share if the screenshot gets cut off.

https://modelshare.mendix.com/models/4028a39a-0052-4627-8a11-8e0b87e28014/example

Hope this helps!

answered
0

Thanks Austin! On the second Retrieve, it says “list of” instead of just the object name; does that matter? I also get an error saying a value is required on the Change action/

answered