to recover the value of a field - InfoPath Dev
in

InfoPath Dev

to recover the value of a field

Last post 11-26-2008 12:52 PM by djibson. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 11-25-2008 08:09 PM

    to recover the value of a field

     

    I have a problem to recover the value of a field.  I have  a exeception : “ The exception Xpath is not managed by the user code.”
    (The manager namespaces or XsltContext is required. This request has a prefix, a variable or user-defined function.).  I use Visual basic and InfoPath 2007.

    Dim  xmlDoc  as XmlDocument

    Dim Node as XmlNode  

    Dim sVar as String

    Node =xmlDoc.DocumentElement.SelectSingleNode("/my:mesChamps/my:CODE_RISQUE")

    sVar=Node.value

    Please help me

     

    Filed under:
  • 11-25-2008 08:35 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: to recover the value of a field

    Hello,

    In your code you are not initializing for ‘xmlDoc' variable. Just you declared as variable without initializing any value. As per the code ‘xmlDoc' is null then we much not able execute next step is ‘xmlDoc.DocumentElement' property.

    Check once your code.

  • 11-25-2008 10:55 PM In reply to

    Re: to recover the value of a field

    It looks like you want to be using code more like this:

     Dim Node as XPathNavigator
     Dim sVar as String

     Node = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:CODE_RISQUE")
     
    sVar=Node.Value

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-26-2008 09:53 AM In reply to

    Re: to recover the value of a field

    I am a beginner with InfoPath and the key for me, to recover the value of the field.

    I think the error is in the path xpath : /my:mesChamps/my:CODE_RISQUE

    Please help me 

  • 11-26-2008 10:19 AM In reply to

    Re: to recover the value of a field

    Are you using InfoPath 2007? If so, you can right click the field in the data source task pane and copy the xpath....

    Hilary Stoupa

  • 11-26-2008 12:52 PM In reply to

    Re: to recover the value of a field

    I solved the problem using the following code:

    Dim Node as XPathNavigator
     Dim sVar as String

     Node = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:CODE_RISQUE", Me.NamespaceManager)
     
    sVar=Node.Value

    the addition of Me.NamespaceManager

    Thanks Jimmy !

    Thanks Hilary Shiva for answer! 

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.