Mark
Mark

Reputation: 14930

sitecore xpath query that excludes cloned items

I have a multilist field inside of an item template that includes an XPath query to filter the item options.

query:/sitecore/content/mysite/Home//*[@@templatename='MytemplateName']

this works fine, but there are cloned items under /sitecore/content/mysite/Home which show up twice since there are two actual items in the content tree,

how can I alter this query to exclude duplicates?

Upvotes: 2

Views: 470

Answers (1)

Marek Musielak
Marek Musielak

Reputation: 27132

You can check if the value of __Source field is empty.

In this field Sitecore stores information about the original item for cloned items, so this field will be not empty for all the cloned items and they will be omitted in the results:

query:/sitecore/content/mysite/Home//*[@@templatename='MytemplateName' and @__source='']

Upvotes: 3

Related Questions