Search code examples
xpathsitecoresitecore7

Fast Query Fails After Adding Parameter


I am using the Sitecore Developer Center Sitecore XPath Builder to create a query.

The following query correctly works in the source field:

fast:/sitecore/content/#Product Information#/#Image Galleries#//*

This query returns me all the objects underneath the Image Gallery but this is not what I want. I want to include only a specific template called "Image Gallery". I wrote this query.

fast:/sitecore/content/#Product Information#/#Image Galleries#//*[@@templatename='Image Gallery']

This query correctly returns the information in the XPath Builder / Sitecore Query Notation but when placed in the Source Field in another item it fails and returns this error.

End of string expected at position 5.

Thanks for reading! :)


Solution

  • That should work for all List Type fields. Have you used that exact query as the DataSource of your field? If so you need to prefix with query: when specifying as a Source.

    query:fast:/sitecore/content/#Product Information#/#Image Galleries#//*[@@templatename='Image Gallery']

    Using Sitecore Fast Query