3
votes

Sitecore reference talk about some attributes you can use in Query, including @@templatename, @@id and @@parentid etc.

parentid doesn't seem to work - /sitecore/content//*[@@parentid!=''] never returns any result. While /sitecore/content//*[@@templatename!=''] works fine. Sitecore version is 6.5 and 6.6.

Has anyone been able to query with @@parentid? ( Perhaps it uses Ancestor/Descendant table and I'm missing data?? - just a guess )

2

2 Answers

5
votes

It is attempting to parse the value as a GUID and failing. Instead, try an empty GUID like so:

/sitecore/content//*[@@parentid!='{00000000-0000-0000-0000-000000000000}']
2
votes
  • @@parentid only works in fast query.
  • In fast query you can only use ancestor not ancestor-or-self (which doesn't give an error it just does a fallback too ancestor).
  • Also you can't use the pipe | in fast query to concatenate results of 2 or more queries.

I can't for the life of me figure out how to do a "give me the ancestor-or-self of the current node whose parent has id={110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}.