Multi-attribute unique entries Preceding-Sibling - InfoPath Dev
in

InfoPath Dev

Multi-attribute unique entries Preceding-Sibling

Last post 12-14-2007 04:25 PM by Greg Collins. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 12-14-2007 08:18 AM

    Multi-attribute unique entries Preceding-Sibling

    I have read this post http://www.infopathdev.com/blogs/greg/archive/2005/06/08/Display-Only-Unique-Options-in-a-List.aspx
     
    I am doing something similar using a filter directly on the listbox. This Listbox is populated by the XMLDATA from a SharePoint List. The following is my filter.
     

     not(@ows_LinkTitle = preceding-sibling::z:row/@ows_LinkTitle)

     Basically it filters out for unique entries. Here's the problem, I now want to add another filter condition, what I have discovered is that if the first qualifying node is filtered out using this additional filter then it does not appear at all, even though there are subsequent entries.

     My goal is to enhance this filter to work with a subset of nodes, so while now it is getting the first node for each unique ows_LinkTitle I would like to get only the first ows_LinkTitle node where another attribute is equal to x i have tried variations of the following.

     not(@ows_LinkTitle[@ows_EventCancelled="0"] = preceding-sibling::z:row/@ows_LinkTitle[@ows_EventCancelled="0"])


     I guess my inability to do this comes from not knowing how to reference an attribute filtered by atributes of the same node.

     Can you help me out?

     

    Below was Greg's reply

     

      Hi Justin,

     
     XML Nodes are one of three types: Root, Branch or Leaf. The root has no ancestor, just descendants. The branch has both an ancestor and descendants. A leaf had an ancestor, but no descendants.
     
     An attribute is always a leaf node. So in your example below, you are attempting to access an attribute of an attribute -- which can never exist. You need to take a step back to the parent element of the attribute, and then get to the sibling attribute using "../".
     
     While the following change may not work in your scenario, it at least corrects that issue:
     
     not(@ows_LinkTitle[../@ows_EventCancelled="0"] = preceding-sibling::z:row/@ows_LinkTitle[../@ows_EventCancelled="0"])
     
     If this still doesn't work, try this:
     
     not(@ows_LinkTitle = preceding-sibling::z:row/@ows_LinkTitle[../@ows_EventCancelled="0"])

    -Justin Devine
    Consultant
  • 12-14-2007 04:25 PM In reply to

    Re: Multi-attribute unique entries Preceding-Sibling

    Hi Justin... thanks for posting this for us.

  • 12-14-2007 04:25 PM In reply to

    Re: Multi-attribute unique entries Preceding-Sibling

    By the way, did this solve the problem?

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