Store in a variable the sum of the column of a datagrid
Hello to all Mendix professionals. I am a beginner in the Mendix world. I have a dataGrid with a column where the values are summed with the SUM property. But I would like to show that result in another view or if it is possible to save it in a variable to be later used in another instance. I appreciate your attention and your help.
This Sum is not really stored somewhere. However, you can calculate the same in a microflow and store it wherever you want. Depending on the data you are showing in the Grid and the filter options you have, there is multiple ways to do so.
If you allow your user to filter the grid (Also if you don’t), you could just add a button to the grid that triggers a microflow, with a List of objects as input (This will by default get the entire list of objects from the grid). Now you can have an aggregate List action that is taking the sum and storing it somewhere.
If you don’t allow users to filter, you could just have a Microflow (Datasource Microflow of a Dataview or whatever) that is executing the same Xpath as your grid and then do the aggregation and store it somewhere.