Does @@parentid attribute work in Sitecore query?

假如想象 提交于 2019-12-12 16:15:51

问题


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 )


回答1:


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:


  • @@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}.



来源:https://stackoverflow.com/questions/12719704/does-parentid-attribute-work-in-sitecore-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!