Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Infopath
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 05:17 PM.

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