Questions tagged [sitecore-query]
For questions related to the syntax of and issues with Sitecore Query notation
99
questions
1
vote
3
answers
91
views
How to filter items that have at least one child with an specific template using Sitecore query
It's easier to explain what I'm trying to do with an image, so let's go!
I need a query to get all parent items that have at least one Promotion Content as a child.
The same for the contrary, I need ...
1
vote
1
answer
62
views
How to get results based on current context language using rendering variant Search Build Query?
I am using rendering variant query item to write the search build query to get the related items.
I want to query items that should also match current user context language.
I have tried using ...
1
vote
2
answers
48
views
Sitecore facet query on key displaying extra non-selected values
I'm trying to use the Sitecore Solr query to retrieve specific facet values for a Sitecore item. The facet is a checklist filter and the field is a tree list type.
var test = context.GetQueryable<...
0
votes
1
answer
171
views
Solr Error : ["undefined field query"]
We have upgraded our Sitecore instance from 8 to 9.0.2 version. In one of our component on datasource level we are using query like below.
query:./ancestor-or-self::*[@@templatename='Website']/Local ...
2
votes
1
answer
151
views
Get Sitecore Items based on the dates by using graphql
I have a requirement to fetch the news items in between the fromDate and toDate. fromDate and toDate need to pass as a parameter so i am unable to forming the query. for your reference please find the ...
1
vote
1
answer
76
views
Sitecore datasource query by comparing pubDate to current date RSS Feeds
So I have this query:
query:$home//[@@name='blogs']//[@@templatename='BlogArticle' and contains(@date, '202208')]
It works fine, but my goal is to compare the value of the @date field to the current ...
0
votes
0
answers
19
views
String error on Sitecore.Context.Database.SelectSingleItem() query [duplicate]
I am trying to run a fast query, however it is throwing an error after upgrading from 7.2 to 10.1 on SelectSingleItem().
Sitecore.Context.Database.SelectSingleItem("fast:/sitecore/content/#LJMU ...
1
vote
1
answer
592
views
Sitecore 10.1 Fast Query CompositeDataProvider System.NullReferenceException
I have faced an issue with fast queries in Sitecore 10.1.
When I execute SelectSingleItem fast query:
Database.GetDatabase("master").SelectSingleItem($"fast:/sitecore/system/Modules//*[...
1
vote
1
answer
414
views
How to write query for multiple Datasource locations
The content tree is like this
sitecore
|_ content
|_ Home
|_ Datasources
|_ Banners
|_ About
|_ Datasources
|_ Banners
|_ Datasources
|_ Banners
Home & About are ...
1
vote
2
answers
818
views
Need help with a Query to select a data source context, for each site
I have a page template where when the site was setup it referenced the folder(Item ID), but now I have multiple sites and need it to reference ONLY the sites folders not just the main site. I am ...
0
votes
0
answers
19
views
Multiple root nodes for DropTree [duplicate]
I am using SXA and have multiple sites, I want DropTree to have two data sourcesas below.
/sitecore/content/Tenant1/SiteFolder/LocalSite1/Data/SomeFolder
/sitecore/content/GlobalSite/Data/SomeFolder
...
1
vote
1
answer
841
views
Find the home path of an item
I have custom button in Core database and I want to get the home path of an item.
This is the item /sitecore/content/Test/Retail/TestShop/home/whats-on/event-1
This is the home path '/sitecore/content/...
1
vote
1
answer
144
views
Sitecore Default Bucket Query For Multiple Templates
I need to build a sitecore default bucket query for a bucketable folder which will display the articles which are based on different page templates. I was not able to find a specific syntax which we ...
2
votes
1
answer
640
views
Droptree field source query to filter on base templates
I am looking to add a source to the Droptree field. This is working fine, but the issue is that it allows all the templates under the home item to be added. But I want to limit it to only items which ...
1
vote
1
answer
1k
views
Sitecore Solr query in C# combination of AND and OR condition
I want to search all the pages, based on "Template A" or "Template B" or "Template C" and page should be inside this location "/sitecore/content/Home/Services/"
...
1
vote
0
answers
424
views
How to build Sitecore SXA Scope Search query with comoperations
I have requirement to show the query results based on the logged-in user-profile details, I was able to pass the query token field value dynamical by following the code.
How to write a SXA search ...
2
votes
1
answer
586
views
Sitecore query with two paths?
I'm configuring an RSS feed in Sitecore, and I'm using a query to select my items. I have a huge number of articles under /sitecore/content/articles/issues organized into folders by year (e.g. /2010, /...
1
vote
1
answer
202
views
SXA Search box - add SXA token support to Rendering parameter for SearchPageResults
We have an SXA Search box defined on a partial design in our Master Shared site. The problem is we need to have the SearchPageResults rendering parameter field use a query to pull the search results ...
0
votes
1
answer
457
views
combined value of source property from 2 multilist fields to one [duplicate]
I have 2 multilist field in sitecore template.
below is value of source property for field1 and field2 and I'm getting list of items to select right side.
field1:
query:/sitecore/content/x/y/website/...
1
vote
2
answers
523
views
Sitecore 9.2 Query not returning all matching items on Azure production
We have multiple environments for a website including local, UAT (single Azure instance), CM (Azure production for authoring) and CD (content delivery).
The following code is on all instances and ...
1
vote
1
answer
226
views
Not able to get count from Search response using Glass Mapper
Environment details: Sitecore 9.0.2 with Solr and GlassMapper
I am using the method:
public IEnumerable<TModel> GetAll<TModel>(string query, string language) where TModel : class
...
1
vote
0
answers
273
views
Xpath field contains case-insensitive string
I've been searching here for a solution but at least when I've tried out the answers in the Xpath builder I always get errors. I'm using Sitecore 8.2. The current query is:
/sitecore/content/...
2
votes
1
answer
607
views
Template field | Exclude filter on basis of template for TreeList and TreelistEx
Sitecore version: 9.0.2
What I am trying to do:
I have created a template. In one of the fields, I need to have my data type as 'TreeList'/ 'TreelistEx'. 'TreelistEx' is preferred.
The functionality ...
2
votes
1
answer
3k
views
How to query multiple datasources & multiple templates in sitecore query
The content tree is as follows:
sitecore
|_content
|_Site1
|_Home
|_Articles
|_Category
|_article1
|_article2
|_Site2
|_Home
|_Rewards
|...
0
votes
0
answers
189
views
Sorting a Sitecore query used to populate a droplink
We have a query that's populated a droplink that displays photo items. It's grabbing these items from multiple locations, so the query is concatenating those subparts of the query. I'm wondering if ...
2
votes
0
answers
542
views
Build Scope Query to Get First level of Children
I am using Sitecore 9.1.1 and SXA 1.8.1
I have an item called Seat, this item is a parent to many other items on multiple levels of two templates, Topic Details and Topic Listing.
In Seat (my parent ...
0
votes
1
answer
1k
views
Sitecore Powershell - Get all items under buckets
I am trying to see if I can traverse through every node in a bucket and get all its items using PSE. All I am able to get is only the root bucket folder.
I tried all the below options with no luck.
...
0
votes
0
answers
746
views
Problems with spaces in SPE Sitecore queries
I am using Sitecore 9.0 and SXA 1.8 and scaffolded a new tenant and site named New Tenant and New Site. When executing the following query using SPE I get not results:
Get-Item -Path master:// -Query ...
1
vote
1
answer
309
views
Sitecore JSS component datasource xPath query
I am having following content tree
Sitecore
Content
myapp
home
-Products
-Product-1
Related-Products-1 (based on Related-Products custom template) – having multi-list field in which we can ...
1
vote
2
answers
2k
views
Multi-root treelist with queries
I'm trying to use the Multi-root treelist that Kam Figy made and that Zachary Kniebel extended. I used this guide to add the Field-type to the Core database.
All is well, until I put query: anywhere ...
1
vote
0
answers
46
views
Multitennant Datasource locations for treelist
For input fields which support the query syntax its no problem like
Droplist
Grouped Droplist
DropLink
Grouped Droplink
Checklist
Multilist
Droptree
here I am using the following query
query:./...
1
vote
0
answers
42
views
Sitecore query to segregate items based upon selected value [duplicate]
Sitecore: 9.0.2 + SXA 1.7.1
What i was trying to do:
Inside a parent item 'Locations', i have multiple children items created on a common template. Each children item has a multilist field 'Location ...
1
vote
1
answer
218
views
Using part of an item name as query filter
So, I'm trying to work my way to what is essentially a great aunt/uncle of the context item and then looking to its descendents for specific item types.
So there's a folder and within that folder ...
2
votes
1
answer
2k
views
Any way to filter a treelist with just the source property of the template field?
I have a treelist that I'm pointing at a folder for items, which works fine, but when I attach some kind of filtering clause, like /*[@@tid='{ID}'] it just defaults to the root of the sitecore content ...
4
votes
1
answer
470
views
Multiple queries for a droplink - removing duplicates
So, I have multiple organizations content on my site, they are all grouped into a regional content area, and I also have a global content area. One of my templates looks into a folder that has a ...
0
votes
1
answer
337
views
set relative query to datasource
Each Article uses datasource underneath.
I'm using query to find CTA button of current item but it returns nothing.
query:.//Article Datasource/Article Top Content
.
2
votes
2
answers
511
views
Sxa tokens not taken into account in code query
I am working on a custom field which is based on :https://marketplace.sitecore.net/en/Modules/A/Advance_Image_Field.aspx
I am trying to make it suitable for SXA by changing the way to find thumbnails....
1
vote
1
answer
248
views
Multilist pick subcategory based on the category selection
I have a Categories Item and Each category has Sub categories
- Category 1
- Sub Category 1
- Sub Category 1
- Sub Category 1
- Category 2
- Sub Category 2
- Sub ...
9
votes
1
answer
2k
views
What are the limitations of Fast query?
After reviewing this question and answer you can see that the use of Fast query is the leading cause of migraines. (<- unverified claim)
What are limitations a developer should take into account ...
0
votes
0
answers
30
views
Sitecore AD configuration of component 1.3 without domain name Login
I have integrated with Active Directory 1.3 and Login is happening perfectly fine with with the username as domain\username and password.
My requirement is to just sign in without with domain. For ...
2
votes
2
answers
767
views
Multilist with Search to return descendant items
I am working on Multisite Sitecore instance and For "multilist with search" field I am trying to return all descendant items under folder item from a specific template using these queries
...
0
votes
2
answers
1k
views
Getting all items using a Specific Sublayout using Sitecore Powershell Extensions
I have to get data of rendering parameters used by a specific sub-layout. Is there a way to get all items which are using a particular Sublayout.
Example:
I have a Sublayout "SiteHeader" and it has a ...
1
vote
1
answer
361
views
Multilist with search not loading for non admin
Data on the left side of the multi-list is not loading if the user is a non-admin. I have multisite on a single node so on the data source I've put Sitecore query as StartSearchLocation=query:./...
1
vote
1
answer
708
views
Sitecore keywords in the metadata
Lets say we have 4 renderings on the Page and each rendering has a data source attached to it which has a Keyword field that is being used for SEO purpose.
Is it possible to get all the attached ...
2
votes
1
answer
1k
views
Treelist to show the all the items in which have the items derived from templates mentioned in IncludeTemplatesForSelection parameter
I want to achieve the Treelist in such a way that it shows up all the ancestors of an item which is derived from the template mentioned in the IncludeTemplatesForSelection parameter of the query.
...
0
votes
1
answer
604
views
Where is the value "Item owner: sitecore\smith" from "Quick Info" living in back-end SQL tables?
I'm unable yet to locate a particular "Item owner: sitecore\smith" value I see well-and-alive in Content Editor "Quick Info" of an item, but not in the SQL Server backend tables.
I often pull a ...
0
votes
1
answer
2k
views
using sitecore queries to search for items whose names contain a specific string
I'm using this line of code to search for items whose names are exactly the string i provide in the query:
string query = path + "//*[@@templatename = 'Template Folder' and @@name='" + year + "']";
...
0
votes
1
answer
497
views
How to sort items in a query inside a variant?
I need to sort items returning from a query inside a variant. For example query:.//*[@@templatename='Template']. I need to sort these items since it doesn't work through build query. Any ideas?
3
votes
1
answer
1k
views
Source Query using the current language version
I have a source query over a standard Multi-List field and I want the query to retrieve items based on the current selected language.
Is there any attribute that could handle that in the source query?...
1
vote
1
answer
300
views
Get the list of languages of an item in a droplist field query source [closed]
As a source for a DropList, I would like to use a query that returns the list of languages defined for a specific item.
Is it possible?