Help with Excel Exporter

0
Hello, I'm new to Mendix and exploring its features, particularly the Excel exporter. I have some questions regarding exporting multiple related entities and using templates for specific information. Here's what I'd like to know:   Exporting related entities: Is it correct to export two or more related entities using the Excel exporter in Mendix? If not, could you recommend a better approach?   Relating tables in templates: Can related tables be included in templates to extract more specific information? For instance, if Table 2 is related to Table 1, how can I extract information from Table 2 based on a foreign key in Table 1 using the Excel export feature?   Choosing templates: When exporting data from a page, how can I select a specific template instead of the default one? Is it possible to write logic to access the plugin's database and retrieve available templates to make a selection? I apologize if my questions seem basic or unclear. Any guidance or resources would be greatly appreciated.
asked
2 answers
0

Hi Diana,

 

I think when you want to use the Excel Exporter it always good to first make sure you know what you want the result to look like.

I will try to give you an example based on the domain model you have attached in your question.

If you want a sheet with on each row an object from table 1, this should be your row object in your template. In this case it is hard to show data from table 2, since there is a many to 1 relationship between the entities. 

When it is okay to have a row for each object in table 2 in your export sheet, it is better to use table 2 as your row object.

 

If you want to create your own logic around, instead of using the default buttons, I'd recommend using the GenerateExcelDoc Java action from the module and call it from your own microflow.

 

 

Hope this helps a bit, just let me know if you need anymore details.

answered
0

Hi Diana Tena Nieto,

You can certainly use association while creating the template to fetch data from an associated table. 

 

To be able to Retrieve data from another entity, you have to create an Association between 2 Entities ( Tables ). Associations are relations between your tables which will replace the concept of Primary key and foreign key.

 

The second screenshot from your Question specifies what type of join you want to use for your relation between the table( Inner join, Outer join), which will eventually affect the data to be pushed to your Excel sheet based on the join you have selected.

 

Example of Association for your Reference : 

 

image.png

 

For your third Question: 

To be able to Retrieve specific templates you should create separate flows. In the flow Retrieve the desired template Using the Template name.

 

Follow this documentation:Excel Exporter

 

ATB!!

answered