Filter issue - InfoPath Dev
in

InfoPath Dev

Filter issue

Last post 05-08-2008 04:27 PM by Greg Collins. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-07-2008 10:02 AM

    Filter issue

    Hi all,

    I have the following basic layout for my data source:

    • myFields
      • Hardware (repeating)
        • HID
        • etc.
      • Order (repeating)
        • HWID (repeating)
        • etc.

    In my print view, I would like to show the other information held in the relevant Hardware node where the HID exists within the repeating HWID element of the current Order node. I have tried to use the current() operator to do this to no avail.

    I have nested a repeating section for Hardware within a repeating section for Order on the view. I think the problem is that my XPath is looking for the current HWID rather than the current order and all HWID elements. My XPath is below. How do I get it to look at the HWID elements of the current order please?

    my:HID = current()/my:myFields/my:Order/my:HWID

    I think this is my problem because if I ignore the use of current() it works but shows all HWID items in every Order, but hides the ones that are not yet in an order.

    Your help is greatly appreciated, thanks.

  • 05-07-2008 05:00 PM In reply to

    Your mistake is very common--which is not understanding how current() works.

    If your XPath is a filter on the Hardware repeater, then current() = the repeating Order node.

    The XPath current()/my:myFields/my:Order/my:HWID means absolutely nothing... it points to nowhere.

    If current() points to the Order node, then you would want an XPath more like this: current()/my:HWID

    Do you see the difference? current() is actually a representation of my:Order -- so if you translate that back to what you had it would be this: my:Order/my:myFields/my:Order/my:HWID , which means nothing.

    Hope that helps.

  • 05-08-2008 02:08 AM In reply to

    Cheers Greg... right on the money. I have to be honest, current() does often confuse me!

  • 05-08-2008 04:27 PM In reply to

    current() confuses most people. Once you understand it, it makes life much easier, however, always knowing exactly which node it represents can sometimes present a problem! It bites me sometimes too.

  • 05-08-2008 04:27 PM In reply to

    Anyway, glad to hear its working!

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