You can do the following. It is in VBScript, in JScript you would call parseInt(...) instead of CInt(...)
Function GetCurrenntFooIndex
GetCurrenntFooIndex = CInt(XDocument.GetNamedNodeProperty(XDocument.DOM.selectSingleNode("//my:Foo"), "CTRL656", -1))
End Function
You will need to extract all of your files from the XSN and go into the view. Then search for xdRepeatingTable and find the xd:CtrlId.
Note that -1 will be returned if there is any error. Suggest putting it into a constant.
Finally I have only been able to get this code to work if I go to the Repeating Table property window, click on the Master/Detail tab, and select the Set as Master option, even though the table is not a master/child table. Can anyone explain that?
Jason
http://www.k2distillery.com/