Various objects in Toad Data Modeler can be customized. New tabs can be added to existing forms, new fields can appear on the tabs and you, users, can specify custom values that will be saved with other default model or object properties.
In this article I am going to show you how to enable loading of custom properties through the in-built import from Microsoft Excel files functionality. My friend Petr Sklar created a sample package that can be downloaded here.
Example and Basic Instructions
1. Create a new model for DB2 LUW v 10.5 and then add the CustomExcelImport.txg package to Toad Data Modeler. Content of the package is highlighted on the following screenshot:
2. Create new entity and edit it. On tab CUSTOM PROPERTIES you can specify value for NEW CUSTOM PROPERTY for the entity.
3. If you edit any entity attribute, in this example attribute NAME, on tab CUSTOM PROPERTIES you can define another custom property.
4. Try to export the model to Excel. You will see there columns CustomProperty1 on sheet Entities and CustomProperty2 on sheet Attributes.
5. Add new entity and specify value for CustomProperty1:
6. Do the same for new attributes. In this example I set the value of CustomProperty2 to 2:
7. Save the excel file and try to import it back to the model.
After the import is finished, the values should be accessible on the forms: Entity:
What’s behind the magic?
Select script ImportExcelManager_2, right click the name and choose Edit Source Code:
In the source code, locate function GetDefinitionEntity. See the highlighted area:
On the same line there is another reference to the custom property.
Feel free to modify the script, add new custom properties according to your TDM customization etc. Of course, remember to modify the function GetDefinitionAttribute and do the modifications to both Export and Import scripts: