Loading Default Data into a Repeating Section or Table

P

Paul

I would like to load multiple rows of default data from an xml file which has
been setup as a data source. I have created the repeating section and
assigned the fields in the section to the corresponding field in the
secondary data source. When the form is previewed only the first row of data
is displayed. If I insert a new row, i get the first record as default data
again. I will not always know how many rows will be in the default data that
i want to load.

I have been able to figure out how to read the data I need form the
secondary data source during the FormEvents_Loading event using the following
code:

Dim rootDefaultData As XPathNavigator =
Me.DataSources("DefaultData").CreateNavigator()
Dim nodeDefaultData As XPathNodeIterator =
rootDefaultData.Select("/Document/PPlan/PD/Doc", NamespaceManager)

While nodeDefaultData.MoveNext()
Dim Title As String =
nodeDefaultData.Current.SelectSingleNode("Title", NamespaceManager).Value
Dim Description As String =
nodeDefaultData.Current.SelectSingleNode("Description",
NamespaceManager).Value

MessageBox.Show(Title & " = " & Description)
End While

I cannot figure out how to move those fields into the main data source or
the repeating section. The repeating section contains two text fields of the
same name. From what I have been able to figure out, the repeating section is
not available in this event so I will have to load the data into the main
data source.

Any help with this problem is appriecated.
 
P

Paul

Thanks for the reply.

Right now I am feeling really dense. I searched infoPathDev for examples
that would demonstrate how to insert records into my Main Data source using
code but have not been able to find any. As you can tell from my orignal
post, I am using Visual Basic with InfoPath 2007. Could you please point me
to the posts you referred to? Or at least provide the search terms you used
to find the posts.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top