Tuesday, April 20, 2010

Infopath 2007 : Only first row of repeating table is committed to the database

This was a weird issue I came up with. Here is the background :

I was using Infopath 2007 to receive and submit data to a web service.

I had a repeating table bound to the receiving data and it displayed all the rows. But while submitting only the first row of the repeating table got committed.

Here is what I did to resolve the issue:

I had only one level in the receiving data schema a group called called TestData1 . Because of this the webservice was getting to the child level but not to the parent level. I added one more level in the webservice to change the schema to have TestData1 and then TestData1 again below it .

The web service was modified by adding a new class for the array which included one more level as below:


[WebMethod]

public TestDataArray getTestDataFilteredSorted(string USERNAME, string SORTCOLUMN, string SORTDIRECTION, string QUERY_NUM, string STUDY, string SITE, string QUERY_ID, string SUBJECT, string REVIEW_STATUS)
{
TestData filterTestData = new TestData();
filterTestData.QUERY_NUM = QUERY_NUM;

filterTestData.STUDY = STUDY;
filterTestData.SITE = SITE;
filterTestData.QUERY_ID = QUERY_ID;
filterTestData.SUBJECT = SUBJECT;
filterTestData.REVIEW_STATUS = REVIEW_STATUS;
TestDataArray filterTestDataArrayobj = new TestDataArray();
filterTestDataArrayobj.TestData1 = getTestDataFiltered2(USERNAME, filterTestData, SORTCOLUMN, SORTDIRECTION);

return filterTestDataArrayobj;
}
public class TestDataArray
{
public TestData[] TestData1;
}
Also note that while configuring the submit data connection make sure that you select the top group of TestData under field or group and Select "XML subtree" under include.
With all this configured you should be able to commit more than one row of the repeating table

No comments: