Display Data Retrieved by OQL on Page - Why Via CSV Object? (Crash Course)

0
In this course chapter: https://academy.mendix.com/link/modules/327/lectures/2517/10.2.4-Aggregate-Shift-Data-per-Department we want to run OQL query (which joins 3 entities Shift and Department and Employee, filters them, groups them and shows just 2 columns: department name and number of unassigned shifts). We want to display the result in a table on a page. So normally, I would think OK, we run the query and display the results as a table on a page, simple, right? But no, the microflow includes in the middle part creating a CSV object. What is the reason for this? The course does not say. My hypothesis: features of OQL module? Because in OQL's domain model we see the Query entity and in that OQL and CSV attributes. I understand the microflow ACT_Employee_UnassignedShifts like this: We create an object (NewQuery) from the entity OQL.Query with the OQL query as a member. Export OQL result set to CSV object (it is not the actual physical CSV file but only a representation of the file in an object) We so to say "flatten" the CSV object into a string, so in the string, there is the contents of the CSV file. (now I thought: "aha, now we are going to offer to the user to save it as a physical CSV file on their drive on a page...well, no) We add a new member to the NewQuery - a string with the CSV contents. We delete the CSV object. We open a page with "CSV as Table" Widget displaying the data. So, the microflow is clear, we run OQL query, create a CSV as a text from that and display the data using CSV as a Table widget. But WHY?
asked
2 answers
0

Seems odd indeed. Think it's done to show the capabilities of the OQL module. Also, I guess that by using the csv widget, you do no need to create an entity to map the output fields of the query to. So that will save you some time perhaps.

answered
0

OK, thank you!

answered