Filter data on repeating table

M

mcchu

Hello,

I like to filter data on a repeating table using the Filter Data feature of
the control.

I want to only show rows that are filtered based on only unique field
values. For example, I have the following schema:

myRow
Key
value

Sample data:
key value
1 10
1 20
2 30
2 40
3 50

I only want to see the following rows in the table:
Sample data Filtered:
key value
1 10
2 30
3 50

Pretty much I only need it to show first row. I try the following filter
expression on myRow, but it did not work. Please let me know what I am doing
wrong.

key = not(key = ../preceding::myRow/key)

Thank you,
Michael
 
M

mcchu

Hi,

I figured out my problem... My Xpath for preceding is one node too far since
the context node is already at the myRow. The solution should be as follows:

key = not(key = preceding::myRow/key)

Now I have another problem. I have two keys now instead of one. I want to
be able to filter rows based on these two keys which are unique.

For example, I have the following schema:

myRow
Key1
Key2
value

Sample data:
key1 key2 value
1 a 10
1 a 20
1 b 30
1 b 40
2 a 10
2 a 20
2 b 30
2 b 40
3 a 10

I only want to see the following rows in the table:
Sample data Filtered:
key1 key2 value
1 a 10
1 b 30
2 a 10
2 b 30
3 a 10

I have tried with the following filter expression(but it doesn't work fully):

key1 = not((key1= preceding::myRow/key1) and (key2= preceding::myRow/key2))

Results...
key1 key2 value
1 a 10
1 b 30
2 a 10
2 b 30 (missing this row.. I know why.. coz 2 happens before
and b as well)
3 a 10
 
M

mcchu

Hi,

Can someone please comment on the previous message on the Xpath expression
which I can use to filter duplicate records based on two unique keys?

The problem is that the current() function will not work when Filter Data is
used here because there is no current context node. However, it seems like
one can make use of the context node when using the child element not inside
a predicate expression.

I have tried many expressions. In most cases, it comes close to what I want
but not fully.

Regards,
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top