Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sitecore rocks query syntax

Started using the query analyzer in sitecore recently, but I am wondering if there is a way to dig deeper than querying by id, name, template, path, etc.

Such as querying by item["mycustomerfield"] = 'something specific'. sitecore rocks is in ctp and the documentation is still coming around.

like image 523
Rob Allen Avatar asked Dec 27 '22 17:12

Rob Allen


1 Answers

You can do lots of things with the Query Analyzer.

John West has a nice introduction here.

Other than that, using the Help keyword can give you some pointers. If you type help select you get some detailed help on the select keyword - including the EBNF syntax.

You can also use the scripting commands from the Sitecore Explorer: Tools | Script | Select.

Here are an example:

Select Title and Text fields from all items under /sitecore/content that uses the Sample Item template.

select @title, @text from /sitecore/content//*[@@templatekey = 'sample item']

Notice the @@ before the system attribute templatekey.

Other than that you should be familiar with identifier escaping. Since Sitecore field names may contain spaces, you have to enclose them in ##.

This selects the field Long Text from home:

select @#Long Text# from /sitecore/content/Home
like image 105
Jakob Christensen Avatar answered Mar 02 '23 20:03

Jakob Christensen