Introduction
This article describes approaches to exporting the Mendix app model to a JSON or Excel file.
Environment
Studio Pro (all versions)
Instructions/Procedure
Option 1: Using the mx dump-mpr command
Instructions:
- Run Command Prompt as administrator.
- Go to the folder where the executable mx.exe file is located. It is the same folder that contains studiopro.exe (for example,
C:\Program Files\Mendix\11.0.0.5003\modeler\mx.exe). - Execute the following command(the
TARGET-FILEpoints to the location of the project file that has the extension .mpr):mx dump-mpr [OPTIONS] [TARGET-FILE] > model_dump.json - A
model_dump.jsonfile is created, containing the app model.
For more information, see the Mendix documentation: mx command-line tool
Option 2: Leveraging the Mendix SDK
The Mendix Software Development Kit (SDK) provides a powerful way to programmatically interact with the Mendix app model. Every model element (pages, microflows, entities, etc.) and its properties are open and accessible via the Mendix SDK. This allows for exporting the Mendix app model and then processing it to generate new representations.
Instructions:
- Set up the development environment for the Mendix SDK.
- Write a script that connects to the Mendix app model via the SDK.
- Iterate through the entities in the domain model.
- For each entity, extract its name, module, attributes (name, data type, length), associations (name, type, related entities), and any documentation/annotations.
- Use a library to write this extracted information into an Excel spreadsheet.
For detailed SDK use cases, see the Mendix documentation: SDK Use Cases
Option 3: Utilizing the Model Reflection Module and Export to Excel
The Model Reflection module, available in the Mendix Marketplace, makes some of the domain model information accessible via the Mendix user interface. Use entities within this module to create a data grid with the necessary information and then add an "Export to Excel" button to that data grid.
Instructions:
- Download and import the Model Reflection module from the Mendix Marketplace into the project.
- In Studio Pro, create a new page and add a data grid to this page.
- Configure the data grid to display information from the Model Reflection entities that expose domain model details (e.g., entities related to
Entity,Attribute,Association). - Add an "Export to Excel" button to the data grid. This typically involves using a Marketplace module for Excel export or implementing custom logic to generate the Excel file from the data grid's content.
For a community discussion on this approach, check the Mendix forum post: Exporting Domain Model to Excel
Outcome
The Mendix app model is exported to a JSON or Excel file.
Internal information related
- 275400, 277989
Additional information
Not applicable
0 Comments