1
votes

Is there a way by using XPath Builder under Developer Center inside Sitecore Shell (a Fast Query interface) to select a particular attribute from an item. Example:

/sitecore/content/Home/Products/*[@@templatename = 'Product Group']/@id

I would expect to see a collection of id's to be returned where id is an attribute of an item. If yes is it possible to extract an attribute with a space bar? Example:

/sitecore/content/Home/Products/*[@@templatename = 'Product Group']/@more info

EDIT The thing that I want to achieve is to get a collection of items (I have few hounded items here), not one particular item. That's why I am not interested in adding additional conditions, like specific item id or title. I want to see a collection of values of a specific attribute. As in example showed above, I want to see a collection of values that are assign to 'more info' attribute. Once again I am expecting to see few hounded different values that are set to 'more info' attribute.

EDIT2 There is a problem with a production, a critical stuff. There is no access to it other then thru Sitecore shell, but I don't have permissions to add/install additional packages. I know how to get this info by implementing custom code, or queering db directly, but I simply do not have permission to do it. Guys that will be able to grant me need credentials will wake up in 6 hours, so I was hoping to do whatever I can to analyse the situation. I would accept Maras answer if it was an answer not a comment - there is no way I can do it using fast query. thanks for help.

1
You can retrieve items only. No way of getting attributes - Marek Musielak
Is this something that you are trying to achieve in code or just in your Sitecore browser client for some results? If it is in browser client, may be give Sitecore Rocks a try. It has a search functionality that will help you get specific results. - Shriroop

1 Answers

3
votes

Try using #

/sitecore/content/Home/Products/*[@@templatename = 'Product Group']/@#more info#

This is the way around when selecting items with fields that contain spaces. Having said that I don't know if you would be able to get a specific result or not for your specific question but give it a try.

For example, consider this query which returns Product S1

fast:/sitecore/content/home/*[@Title = 'Item 1' and @@templatename = 'Product Group1']//*[@Title = 'Product S1' and @@id = '{787EE6C5-0885-495D-855E-1D129C643E55}']

However, if you place the special attribute (i.e. @@id) at the beginning of the condition, the query will not return a result.

fast:/sitecore/content/home/*[@@templatename = 'Product Group1' and @Title = 'Product S1']//*[@@id = '{787EE6C5-0885-495D-855E-1D129C643E55}' and @Title = 'Product S1']

Remember this, Sitecore Fast Query only supports the following special attributes:

  • @@id
  • @@name
  • @@key
  • @@templateid
  • @@templatename
  • @@templatekey
  • @@masterid
  • @@parentid

Let us know if this helps.