I have a repeating table in a List view where each row has a button that when clicked should switch to an Edit view while loading the selected row details. Based on a lot of research and postings I see that there are two ways to accomplish this. One is to put a action rule on the button and the other is custom code tied to the Click event of the button.

My problem is that neither of these solutions seems to work..and for slightly different reasons. The underlying issue is that I cannot seem to extract the field that holds the row id so I can then pass it on the the new view.

The data coming in is via a web service and has the following XPath (not sure if that is the correct terminology) --

myField / dataFields / tns:GetItemsResponse / GetItemsResult / q1:Item / ReferenceId
myField / dataFields / tns:GetItemsResponse / GetItemsResult / q1:Item / field2
myField / dataFields / tns:GetItemsResponse / GetItemsResult / q1:Item / field3
myField / dataFields / tns:GetItemsResponse / GetItemsResult / q1:Item / ...

Action Rule

The rule tries to set a queryField field on a Secondary connection using the following expression


However, when I run it I get the following very unhelpful error message

Some rules were not applied.
Unspecified error

If I set the expression to just


I get back all the values from all the fields as a single concatenated value. This seems to indicate that current() does have the correct row referenced but I just cannot seem to get a specific field.


Meanwhile, the following code pops up an Object reference not set set to an instance of an object exception

Public Sub EditItemButton_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
   Dim sourceNav As XPathNavigator = e.Source.CreateNavigator()


   Dim idNav As XPathNavigator = sourceNav.SelectSingleNode("ReferenceId", Me.NamespaceManager)

End Sub

The first MessageBox call (for sourceNav) shows the XML for the currently selected row. And I see the ReferenceId node in there. But again, I cannot seem to get access to it via the SelectSingleNode.

I have tried all different combinations of ReferenceId including "../ReferenceId", "q1:ReferenceId" (that is what shows in the designer and when I copy the XPath), "a:ReferenceId" (the "a:" is what shows when the sourceNav.InnerXml is displayed..but I do not understand why...)

Any thoughts or ideas?


  • you got any solution for above stated issue? i am having similar issue in my Form. however, i have to use current row filed selected value as filter for another control in the same row. plz let me know if you nailed it. thanks raj
    – user703326
    Aug 1, 2012 at 17:42

1 Answer 1


I do not recall the exact circumstances to solving this issue but the following code ended up working. If I remember correctly the key to the solution was the "local-name" but I could not explain it. One thing I never did come to grips on with InfoPath was all the different XML naming conventions...there just did not seem to be any rhyme or reason to why something was named the way it was.

Public Sub EditButton_Clicked(ByVal sender as Object, ByVal e as ClickedEventArgs)
   ' get selected reference id
   sourceNav As XPathNavigator = e.Source.CreateNavigator()
   idNav As XPathNavigation = sourceNav.SelectSingleNode("*[local-name()='ReferenceId'")

   ' set it for Edit view and fetch data
   Dim wsNav As XPathNavigator = Me.MainDatasource.CreateNavigator()

   Dim referenceIdNav As XPathNavigator = wsNav.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:GetRecord/tns:id", Me.NamespaceManager)


   ' show the view
End Sub

Protected Sub DeleteNil(ByVal node as XPathNavigator)
   If (node.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance")) Then
   End If
End Sub

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.