Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Infopath
|
Infopath Programming and automation discussions only please. :)
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Infopath section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 13th, 2009, 02:18 PM
Registered User
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Infopath has invalid token

How do I retrieve the correct ID in a SharePoint List using vb code after submission and after the form has been signed. I am trying to read and populate the ID field in my form so it can be printed out with a unique ID in that field.

I have the data connection setup correctly, but right now it only returns the first ID in the list. I don't necessarily want the last one in the list, because it may or may not be the last ID in the list. Please help!

This is a browser enabled form.

I am using the following code: but get the invalid token error

' Retrieve the value of the control number
Dim TSRNum As String = xnMyForm.SelectSingleNode("/my:myFields/my:TSRControlNum", ns).Value

' Retrieve a reference to the SharePoint list
Dim xPath As XPathNavigator = DataSources("TSRData").CreateNavigator()

' Search for the id in the SharePoint list
Dim SharePointID As XPathNavigator = xPath.SelectSingleNode("/my:myFields/my:TSRControlNum[@TSRID", ns)
'Dim SharePointID As XPathNavigator = xPath.SelectSingleNode("/dfs:myFields/dfs:dataFields/dfs:TSRData/@TSRID[ /my:myFields/my:TSRControlNum = current()]")

'Check whether the search returned a result
Dim IDRes As String = String.Empty
If SharePointID IsNot Nothing Then
IDRes = SharePointID.SelectSingleNode("@TSRID", ns).Value
End If

xnMyForm.SelectSingleNode("/my:myFields/my:TSRControlNum", ns).SetValue(IDRes)

Thanks for any help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
xpath contains error 'has an invalid token' XMLUser XSLT 7 February 5th, 2008 02:31 AM
Invalid Token sani723 XSLT 2 December 25th, 2007 01:42 AM
XPath Invalid token Hughesie78 XSLT 13 November 29th, 2007 12:59 PM
Can't get past "Token StartElement" error Colonel Angus Classic ASP XML 1 August 10th, 2005 01:21 PM
Unrecognized token was found Dennis Huisman BOOK: Professional Crystal Reports for VS.NET 0 September 6th, 2004 07:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.