p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Other Office > Infopath
I forgot my password Register Now
Register | FAQ | Members List | Calendar | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 13th, 2009, 03:18 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 02:21 PM
Unrecognized token was found Dennis Huisman BOOK: Professional Crystal Reports for VS.NET 0 September 6th, 2004 08:08 AM



All times are GMT -4. The time now is 10:52 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc