That’s the last step. We have Format to parse data to a model, now we need to write data from model back to actual tables. Open model designer and click “Map model to datasource” in the action pane.
Create new record, set name and description. Select direction, for import it should be “To destination”:
Open designer. In the Data Sources area add data model:
Set name, select model and definition:
Add new destination:
Select table you want to insert to, set name, specify if it should support insert or update\insert and if you need validation to be triggered:
Bind Record List from model to tables’ record list and bind field accordingly:
Save and we are ready to test it!
Go back to Model to Datasource mapping screen, select mapping record and click run in the action pane:
Select file and check the result. I do not have UI for this table, so just going to use table browser:
It’s not that nice to trigger import from the mapping record but that’s the only way I know and in the next post we will look how to trigger it from X++ code, so we could have a button somewhere.
As you can see ER is a really powerful tool that allows users to do tasks that were not possible without development before.