I found a solution to grabbing the data, based on what Hilary mentioned in her last post. It involves creating helper fields in the repeating table of the secondary data source.
In the repeating table of the secondary data source create duplicate fields for all of the columns of your data and call them M[FieldName] or whatever makes the most sense to you. These fields will be promoted as merged fields when you publish. The default value in these fields will be a concatenation of the duplicate field's data, a delimiter, and the row reference.
Ex:
I have a field that populates a combo box of product names from a list; ProductName. I create a duplicate field for merged data, MProductName, in the same repeating table. This field (MProductName) is not displayed on the form.
The default value for MProductName is as follows: concat("|", count(preceding-sibling::*), "|", ProductName, "||", count(preceding-sibling::*), "||"). This will result in the following value for MProductName: |1|[ProductName]||1|| |2|[ProductName]||2|| |3|[ProductName]||3||...
Now publish the secondary data source, promoting the repeating table fields M__ as "merged." Now all the data is available for you to parse in your main InfoPath form, with unique delimiters surrounding each field's data.
On your main InfoPath form you have a repeating table in which you wish to populate the data from the secondary data source repeating table.
The default values for these fields should be:
substring-after(substring-before(ProductName[SecondaryDatasourceID = MainDatasourceID], concat("||", count(current()/../preceding-sibling::ProductInformation) + 1, "||")), concat("|", count(current()/../preceding-sibling::ProductInformation) + 1, "|"))
What this says is: in the string for Product Name, from the specific form in the Secondary data source, grab everything before ||[current row number]|| and everything after |[current row number]|. That's it. As long as you have a unique identifier between the datasources to properly filter the data it will populate only the data from the corresponding repeating table element. The nice thing about this is that even if you don't have the correct number of rows prepopulated in the main InfoPath form all the user needs to do is append rows to populate any remaining data.
So it doesn't look as messy or confusing you can always create an additional helper column in each repeating table called "counter." This field would hold : count(current()/../preceding-sibling::ProductInformation) + 1.
counter can take the place of "count(current()/../preceding-sibling::ProductInformation) + 1" in your subsequent fields.
There is an alternative method using the "double eval()" trick to concatenate the data into a field outside of the repeating table, but I could not get that to work.