How to save attributes from a non-persistent entity into a persistent entity so I can utilize the Excel Exporter Mendix module?
0
Hello Mendix Community, I am trying to find a way to export non-persistent attributes. In my application, a user can execute a search for an item. The user can select the item revision they want based on the search results. The page then displays multiple attributes for the selected item revision (within a dataview). In my domain model, attributes are spread throughout non-persistent entities and not on a single entity, but all attributes are linked by associations from the ItemRevision non-p entity. I have created a Domain Model for Excel Export with a persistent entity of System.FileDocument for export. I have created a persistent entity (ItemRevisionDetails) with all attributes on the page, associated it from the non-p entity of ItemRevision (where all attribute data is based on through associations) and then to the persistent entity of System.FileDocument. What is the best way to go about this? Domain Model: Do I need to create a persistent entity with all attributes from multiple non-p entities included? Microflow: Do I need to create a list or does the page parameter give me the information I need? Microflow: Would I need a loop in this case? Currently, I am using the Item Revision non-p entity, creating a RevisionExcelExport object, creating a list of ItemRevisionDetails(my own made persistent entity), retrieving ItemRevisionDetails, changing ItemRevisionDetails attributes with attributes from Item Revision non-p entity, and committing. However, I'm not sure if I need a loop, or need to create a list or if the page parameter will handle it for me. I have read that I need to store the attributes into a persistent entity and delete after my export. That is where I am stuck within my microflow. Any assistance is appreciated as this is my first major Mendix dev assignment. The more I read online, the more confused I become. Thank you!
asked
Michael Claman
3 answers
0
Hi Michael,
you can use
Advanced Excel this module, it comes with several java action by which you can create sheets, rows & columns and download result without needing of persistent entity.you can create a excel sheet and then create a loop of item revision details (which is a list i guess) then inside loop you can retrieve non p entity and associate details and create cells and columns) and outside loop download excel
Another approach will be use regular excel export ,create extra attribute in item revision persistent entity to hold non p entity data ,create a loop of p entity inside loop retrieve non p entity and its association and put a change activity to copy all non p entity and its associated data to p entity and in same change activity put system doc object ( that you have created for excel) in association between p entity and file document and commit them and export.
Hope it helps!
answered
Sharad Suryavanshi
0
Hi Michael,
don't create list, i believe this list you must be getting as parameter , use that in loop
also list which needs to be used in loop, depends on your requirement,
if i have customer entity and customer details entity, then i can loop over customer , so if i have 10 customer then in exel there will be 10 record and inside loop i will retrieve customer details via association and use customer details attribute to fill out the data
answered
Sharad Suryavanshi
0
Hi,
could you paste screenshot of domain model especially those entity which data you need for excel and also sample excel result