XPATH conditional in C# - InfoPath Dev
in

InfoPath Dev

XPATH conditional in C#

Last post 05-05-2008 03:45 PM by Greg Collins. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-01-2008 08:42 AM

    • djay
    • Top 500 Contributor
    • Joined on 06-06-2006
    • Posts 35

    XPATH conditional in C#

    Is there a way to run an XPATH query directly from managed code?

    So I want to be able to run "count(my:RepGroup1)" and return a number.  Or "my:field1 = 'Include'" and get a bool back.

    I know I can do any of this using the API, but I want to use XPATH specifically.  I am pulling an XPATH conditional from an SQL database and I want to perform an action only if the XPATH evals to true.  Right now I have a hacky implementation that uses selectNodes with a filter which returns null when the XPATH is false.  But I am hoping their is a cleaner implementation.

     

    BTW - I am on the 2003 API's.

     

    -Dan

  • 05-05-2008 03:45 PM In reply to

    Re: XPATH conditional in C#

    You can certainly use an XPath like:

    my:field1 = 'Include'

    or

    my:field1[. = 'Include']

    But you cannot use:

    count(my:RepGroup1)

    because this is not supported in code. However, you can do a selectNodes and then get the .Count property for the number you want.

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