I want to print only unique values from a dataset into the list component, avoiding duplicate values. How do I do it ? Please help.
A:
Try something like the following when you are selecting nodes in you datasource using X-Path.
/root/*[not(text() = preceding-sibling::*/text())]
It will select unique nodes for a XML structure like bellow.
<root>
<Node1>Data1</Node1>
<Node2>Data2</Node2>
<Node1>Data1</Node1>
<Node2>Data2</Node2>
<Node3>Data3</Node3>
</root>
Gordon
2010-04-23 15:13:09
I am using XML as the data source.
payal
2010-04-26 03:26:31
I dont want unique nodes, I want unique values from same nodes. For eg. <Product>Prod1</Product> <Product>Prod1</Product> <Product>Prod2</Product> <Product>Prod2</Product> ]Should return Prod1 and Prod2 only once, even though they appear twice in the xml data source.
payal
2010-04-27 04:08:49
+1
A:
You can group on that value, in your case the Product
, grouping will eliminate duplicates.
NOTE: the data should be sorted for grouping to work
medopal
2010-04-27 09:57:22