In this blog post, I will demonstrate a modelling pattern that I often use for importing data from Excel, and explain the choices made. The ExcelImporter component from the Mendix AppStore is one of the most used business components in Mendix. So, as a Mendix business engineer, this one should be in your toolbox! I will use a real-life case to demonstrate how I think you can use it best.
The easiest way to add the ExcelImporter module to your project, is to click the ‘AppStore’ button from the Mendix Business Modeler.
The ExcelImporter is listed in the Most popular components. Click it, and then click the ‘Download’ button. Also, read the documentation of the appstore module. After downloading, add the ExcelImport as a new module to your project.
Now, if your project suddenly contains a lot of errors, you are missing the MxModelReflection module. Don’t worry about the errors: just download and add the Mx Model Reflection module from the AppStore, and these errors will be resolved.
Consider the following user story:
As a stock manager, I want to register each delivery, in order to keep track on the stock
From our supplier, we receive an Excel file with delivered products for each delivery. This leads to the following domain model in the module ‘Stock’:
Multiplicity: One Delivery object is associated with multiple DeliveredProduct objects. On delete of Delivery object: Delete DeliveredProduct objects as well.
The DeliveryFile inherits from ExcelImporter.TemplateDocument, which is itself a specialization of System.FileDocument. This allow file uploads/downloads to the Mendix application.
Why is a specialization of TemplateDocument needed? Read More