Moving data to a repeating table on a button click

H

Howard Hayes

I am trying to populate a repeating table when a button is clicked. I
manually increment the repeating table by selecting Insert Row and then click
the button. Doing so erases all previous data and populates each row with
the new data. No matter how many rows I add, the data added on the button
click populates every row of the table. The Click causes rules to process
and parse data from a field into the various fields in the table. Please
help.

Thanks,
Howard Hayes
 
B

BobCh

A sample...

Public Function of_AddActivityRow(ByVal as_Type As String,
ByVal as_Notes As String, Optional ByVal ab_SkipIfNew As Boolean =
True, Optional ByVal as_Mode As String = "Prepend") As Integer
Dim ll_RC As Integer = 1
Dim mainDomNavigator As XPathNavigator =
MainDataSource.CreateNavigator()
Dim dtTodayDate As String =
System.DateTime.Now.ToString("yyyy-MM-dd")

Try


If Me.[New] And ab_SkipIfNew Then Return -1


Dim xnNode As XPathNavigator
xnNode = Me.Template.Manifest.SelectSingleNode("//
xsf:xDocumentClass/xsf:views/xsf:view/xsf:editing/
xsf:xmlToEdit[@name='Details_386']/xsf:editWith/xsf:fragmentToInsert/
xsf:chooseFragment/my:Activity", Me.NamespaceManager)
If as_Mode.ToLower = "prepend" Then
mainDomNavigator.SelectSingleNode("/my:myFields/
my:Activity", Me.NamespaceManager).PrependChild(xnNode.InnerXml)
Else
mainDomNavigator.SelectSingleNode("/my:myFields/
my:Activity", Me.NamespaceManager).AppendChild(xnNode.InnerXml)
End If
mainDomNavigator.SelectSingleNode("/my:myFields/
my:Activity/my:Details/my:ActivityType",
NamespaceManager).SetValue(as_Type)
mainDomNavigator.SelectSingleNode("/my:myFields/
my:Activity/my:Details/my:Act_Notes",
NamespaceManager).SetValue(as_Notes)

Catch ex As Exception

End Try



Return ll_RC

End Function
 
A

ArnieC

How would I do this using C# Managed Code with InfoPath 2003?

I have a repeating table in a section in my form Called StatusActivity.
Everytime a user opened and resaved the form I want to add an activity line
with their name (field on form), and current date.

Thank you
BobCh said:
A sample...

Public Function of_AddActivityRow(ByVal as_Type As String,
ByVal as_Notes As String, Optional ByVal ab_SkipIfNew As Boolean =
True, Optional ByVal as_Mode As String = "Prepend") As Integer
Dim ll_RC As Integer = 1
Dim mainDomNavigator As XPathNavigator =
MainDataSource.CreateNavigator()
Dim dtTodayDate As String =
System.DateTime.Now.ToString("yyyy-MM-dd")

Try


If Me.[New] And ab_SkipIfNew Then Return -1


Dim xnNode As XPathNavigator
xnNode = Me.Template.Manifest.SelectSingleNode("//
xsf:xDocumentClass/xsf:views/xsf:view/xsf:editing/
xsf:xmlToEdit[@name='Details_386']/xsf:editWith/xsf:fragmentToInsert/
xsf:chooseFragment/my:Activity", Me.NamespaceManager)
If as_Mode.ToLower = "prepend" Then
mainDomNavigator.SelectSingleNode("/my:myFields/
my:Activity", Me.NamespaceManager).PrependChild(xnNode.InnerXml)
Else
mainDomNavigator.SelectSingleNode("/my:myFields/
my:Activity", Me.NamespaceManager).AppendChild(xnNode.InnerXml)
End If
mainDomNavigator.SelectSingleNode("/my:myFields/
my:Activity/my:Details/my:ActivityType",
NamespaceManager).SetValue(as_Type)
mainDomNavigator.SelectSingleNode("/my:myFields/
my:Activity/my:Details/my:Act_Notes",
NamespaceManager).SetValue(as_Notes)

Catch ex As Exception

End Try



Return ll_RC

End Function




I am trying to populate a repeating table when a button is clicked. I
manually increment the repeating table by selecting Insert Row and then click
the button. Doing so erases all previous data and populates each row with
the new data. No matter how many rows I add, the data added on the button
click populates every row of the table. The Click causes rules to process
and parse data from a field into the various fields in the table. Please
help.

Thanks,
Howard Hayes
 

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