repeating tables infopath 2007

O

Omar B

I have added logic to the changed event on two fields that reside in a row of
a repeating table. The logic calculates a value that is then stored in a
third field in the row. This works fine for the first row however when a
second row is added the logic does not work. Must I add logic to the change
event of the table itself inorder to apply the logic to the added rows and if
so how is that done?
 
S

Swathi (GGK Tech)

Hi,
Can you give the code line what you are using in the changed event. I think
you are using the xpath to get the values instead use the e.site values.
 
O

Omar B

Public Sub dt_begin_Changed(ByVal sender As Object, ByVal e As
XmlEventArgs)
' Write your code here to change the main data source.
Dim myNav As XPathNavigator = Me.MainDataSource.CreateNavigator()
Dim chours As XPathNavigator =
myNav.SelectSingleNode("//my:txt_hours", NamespaceManager)
Dim cbeg As DateTime = myNav.SelectSingleNode("//my:dt_begin",
NamespaceManager).Value
Dim cend As DateTime = myNav.SelectSingleNode("//my:dt_end",
NamespaceManager).Value


chours.SetValue(DateDiff(DateInterval.Hour, cbeg, cend))
myNav = Nothing
cbeg = Nothing
cend = Nothing

End Sub
 
S

Swathi (GGK Tech)

Hi,

You need to change the Xpaths. Use the following code lines.

Dim chours As XPathNavigator =
e.Site.SelectSingleNode("../my:txt_hours", NamespaceManager)
Dim cbeg As DateTime = e.Site.Value;
Dim cend As DateTime = e.Site.SelectSingleNode("../my:dt_end",
NamespaceManager).Value
 
O

Omar B

Ok thanks.

Swathi (GGK Tech) said:
Hi,

You need to change the Xpaths. Use the following code lines.

Dim chours As XPathNavigator =
e.Site.SelectSingleNode("../my:txt_hours", NamespaceManager)
Dim cbeg As DateTime = e.Site.Value;
Dim cend As DateTime = e.Site.SelectSingleNode("../my:dt_end",
NamespaceManager).Value
 

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