This article describes a new feature of the EcoSpaceDebugger. The feature lets you easily import any tab separated data into any eco-based system and enable you to define transformation on how to interpret the data and also look up values in order to set links.
So suppose you find some data somewhere.
And you have model that should hold it:
And that you can create a view model that explains how to receive the data
Now click up the system prototyper:
Start the system and click up the debugger:
Switch to the “Import tab separated” tab, enter the ViewModel that you want to control the import, press “Get headers from viewmodel” to the names in columns – in this case Code and Name:
Paste in your tab separated data and press GO:
Now you have created objects – switch to the “Dirty Objects” to save them…
The “UseKey” flag
The UseKey instructs the logic to pick the first column, and try to look up this value with <ClassFromViewModel>.allinstances->select(keyname=’valueinfirstcolumn’). If an object is returned it will be used for update – if none is returned a new will be created. This will give one such evaluation per imported row.
Often you will want to assign a link when importing your data. This is done by designing a ViewModel that has PickLists. This is powerful since the lookup will be made on the result of the expression of the Associated viewModel Class. The lookup will be done in memory in dictionaries and will be very fast.
Creating link objects
Link objects can be created the same way. You will need to provide the two keys needed for the association in the first 2 columns.