This post will show you how to create an auto generated row number for your repeating table in InfoPath. Having a numbered column in your repeating table helps separate the user entries:
First create a repeating table with an extra column for the Row Number. I would recommend re-naming both the repeating table and row so it’s not group1 and group2. In this example I’ve named them RemoteSiteRepTable and RemoteSiteRepRow. The row name is especially important as you will be using it in your formula. I also renamed the first field to RowNum:
Right click your RowNum field and choose Textbox Properties. Change the Data type to Whole Number (integer). Click on the function (fx) button to open the Insert Formula window and paste the following formula (renaming RemoteSiteRow to your row name) into the value field:
count(../preceding-sibling::my:RemoteSiteRow) + 1
Hit the Verify Formula button which will resolve the formula to:
count(preceding-sibling::RemoteSiteRow) + 1
Click the OK button to return to the Text Box Properties screen and make sure the Refresh value when formula is recalculated checkbox is selected and hit the OK button: