xpath contains() function - InfoPath Dev
in

InfoPath Dev

xpath contains() function

Last post 06-02-2010 10:49 AM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-02-2010 08:34 AM

    • arcad
    • Not Ranked
    • Joined on 05-10-2010
    • Posts 15

    xpath contains() function

    Hello,

    I am trying to use the contains() function as a wildcard search. My second attribute is a string. I am getting "an xpathexception was unhandled by code". Do you have any ideas of how I could fix that?

    Thanks a lot!

    string Ep = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:group1/my:Person/my:DisplayName", NamespaceManager).Value;

    XPathNodeIterator rows = secDSNav.Select("/dfs:myFields/dfs:dataFields/dfs:Assets[contains(@EpData,'" + Ep + "')]", NamespaceManager);

  • 06-02-2010 08:48 AM In reply to

    Re: xpath contains() function

    Do you know what the value of Ep is in this code?  Might it contain any apostrophies?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-02-2010 10:22 AM In reply to

    • arcad
    • Not Ranked
    • Joined on 05-10-2010
    • Posts 15

    Re: xpath contains() function

    Yes some values contained some apostrophes. Thanks!

  • 06-02-2010 10:49 AM In reply to

    Re: xpath contains() function

    Does it work if you use:

    XPathNodeIterator rows = secDSNav.Select("/dfs:myFields/dfs:dataFields/dfs:Assets[contains(@EpData,'" + Ep.Replace("'", "'") + "')]", NamespaceManager);

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.