I’m not sure if there’s an easy way to select an entity based on its name. It seems to me you’re going to need a lf decision actions to look one at a time and explicitly ask .. if tablename columns=’This’ then create an instance/record of the “This” entioty. In the false path you’ll do another “if tablename column=’That’, then create a ‘That’ entity/object and so on. If you have a static, limited number of tables/entites this won’t be too bad. If the list of table/entity names changes frequently or is long, this might not be the best solution.
The only other thing I can think of is to download the MxReflection module and take a look at how its microflows work. This module, once you link to it in your app, exposes the names of your modules, entities, microflows, etc to the application (for example when using excel uploader, it allows your page to see the names of the entities”. In other words, it provides the “meta data” about your database to the user so there’s something in there that eventually knows how to tell what your table/entity names are. Maybe you can look at the logic that is called in the MxReflection module that executes when you click the “Refresh List” button. Somewhere in the microflow it has to obtain a list of all the entity (table) names and attributes so you may be able to copy how that works.
You can import Community Commons module https://marketplace.mendix.com/link/component/170 to your application
Use copyAttributes java action to use this.
You have to use Source object (Main object which contains data) and choose Target object (New object to copy the data from Min object)
Hope it helps!
Thank you all for your reply.
This is what I built to copy the data from one entity to another. It works for what I need to do.
It would have been nice to just use an IF statement and Create an Object that points to a Variable name / Entity name that is built from a string variable:
Unfortunately this is not possible as Create Object needs to point to an Entity .