XPath Example? - InfoPath Dev
in

InfoPath Dev

XPath Example?

Last post 09-27-2007 07:28 PM by Jeff.Wang. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-26-2007 04:19 PM

    XPath Example?

    I want to be able to query a repeating table for a particular row matching a simple dynamic condition.  I'm new to XPath so I'm sure this is a dumb question.

    Say I have a DataSource like this:

    People

    - Person

    -- Name

    -- Email

    QueryName

    QueryEmail

    I want to be able to enter a name into QueryName and have it display the correct Email from the People collection based on Name matching QueryName.

    If I'm stupid about it I do this:  ../my:People/my:Person/my:Email

    But that just always returns the Email value from the first element of the repeating section.

    So I start playing with XPath expressions. For example:  ../my:People/my:Person[last()]/my:Email  returns the Email from the last group in the section.

    But how do I do a @ statement?  Nothing seems to work.  If I try to insert fields in the XPath I get complaints about "node-test expected" unless I strip off the "../" portion, and then nothing happens when I try that.

    I obviously have to cut my teeth on this XML stuff a bit more :-) but pointers would be appreciated.

     

  • 09-26-2007 05:22 PM In reply to

    You probably want something along the lines of: /my:People/my:Person[my:Name = ../../my:QueryName]/my:Email

     

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-27-2007 07:28 PM In reply to

    • Jeff.Wang
    • Not Ranked
      Male
    • Joined on 06-18-2007
    • Sydney, Australia
    • Posts 13

    It works if you use following codes:

    my:People/my:Person/my:Email[../my:Name = ../../../my:QueryName]

    You can simply do this using the "Filter Data..." option in the "Select a Field or Group" dialog.

     

    jeff.

     

    Jeff Wang
    Sydney Australia.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.