Savan,
Hope this helps, Mike
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.
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