Let's add an event to our table.
/* Rhino code */var q=$iwb.sqlQuery('select count(1) xxx from x_person');var cnt=1*q.get('xxx');var result=false;if(cnt>2)result='Max Allowed Users=10, Current='+cnt;
This event is triggered before any insert action and if an action tries to insert 3rd record in database table then it will be stopped by the event with a message.
As you see in the image below there are 2 records. User cannot add another record.
This event can also be written in SQL:
select 'Max Allowed Users=10, Current='||x.cnt as resultfrom (select count(1) cnt from x_person) as x where x.cnt>2
If query returns result, the action that user wants to perform will be stopped with a message.