Hey,
One approach is as you have mentioned and if you could compromise on Delete too there is a work around.
1. Select the repeating control on the Infopath form
2. Select Conditional Formatting
3. Click Add
4. Select Expression
5. count(/my:myFields/my:group2/my:group3) > 2 -> Replace group2 and
group3 with the names from your datasource)
6. Select Don't allow users to insert or delete this control
Let me know if it worked!!!
OR
Rather choosing Rules, you can go with conditional formatting on Repeating Table.
Take a counter,which can count the no of rows in that repeating table and apply the conditional formatting to Repeating table saying, if
the counter = 4 the condition is "don't allow the user to insert and delete the row".
Fine, I will tell you the problem(in both the above cases), if the user add 4 rows, it wont allow to insert new row and at the same time it wont allow to delete the row also.If this is
fine you can go with this approach, otherwise the only solution in that case is the programming.
Thank you