Hi, I want to count number of entries done on a Data grid and show the total at the bottom. So, i don't want value added up but the total number or rows. 1) How do i add a total of grid at the bottom of the table? 2) How can I count number of rows on data grid? 3) How can I check for example if no. of rows = > 3 than when u click the Microflow(new button) it should say that rows are full you can't add any more candidates. Hopefully you can help. Thanks in advance.
The total row will appear at the bottom of the datagrid when you set up aggregate functions for one or more columns
One of the aggregate functions you can use is count, which will display the number of rows in your datagrid
Build a microflow that has a parameter which is a list of the type of entity in your datagrid. When you put the microflow button on the datagrid, the On click settings should be set to pass all pages of the datagrid object. Then, in your microflow, the first thing you can do is use an aggregate list action to count the number of objects that were passed in. Finally, use an exclusive split to check the count. If it is greater than 3, use a Show Message action to inform the customer that they have too many items, if not, you can proceed
Hope this helps,
1) See: https://world.mendix.com/display/refguide4/Columns , section about aggregate function.
2) There is no standard functionality to count the number of rows. What exactly do you want to do, when do you want to count the number of rows?
3) You create a new microflow instead of using the new button. As parameter to this microflow, you pass all objects (the option is called 'All Pages', but be careful: if you allow filtering in this datagrid, this will not work, and you will have to use a retrieve action with the same XPath constraint as your data grid to retrieve the relevant objects). You then use the aggregate list action to count the number of objects in your list. If count < 3, then create a new object and show a form, if count >= 3, then display a message.
Rom van Arendonk
Thanks guys this was really helpful. I got it working.
1+2) Add the aggregate function count() to the column
(it seems that this only works for numeric data, although count() should not depend on the data type)
You could also retrieve the column count with a microflow and display it using the Microflow Label (see AppStore)
3) Use a microflow, instead of the standard new button, which checks the column count