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"])