sitecore xpath query that excludes cloned items - xpath

I have a multilist field inside of an item template that includes an XPath query to filter the item options.
query:/sitecore/content/mysite/Home//*[##templatename='MytemplateName']
this works fine, but there are cloned items under /sitecore/content/mysite/Home which show up twice since there are two actual items in the content tree,
how can I alter this query to exclude duplicates?

You can check if the value of __Source field is empty.
In this field Sitecore stores information about the original item for cloned items, so this field will be not empty for all the cloned items and they will be omitted in the results:
query:/sitecore/content/mysite/Home//*[##templatename='MytemplateName' and #__source='']

Related

How to use values from a list aggregated field in a table to a filter in Quicksight?

I have a dashboard in Quick-sight where a table is being used which contains a field that has values list aggregated.(Please refer the attached image).
I need to create a filter in a dashboard that will have a dropdown with distinct values from the list aggregated values so that if i select/check a particular value from a dropdown then it should filter out the list aggregated record by matching the string i selected in a drop down.
I tried to use the split function to get the distinct values from the list aggregated values from the field. However, the filter did not work as i expected.
Please suggest possible solution. Will appreciate any suggestions.

How can I create a list of values for a field in Kibana?

I am using Kibana to view data from Elasticsearch index. There is a field only has a few values. When I do search the field, how can I make the search bar as a select rather than a free text input? I know that there is a filter list like below image:
but it doesn't work for the case that top 5 values in 500 records have one value. How can I show all values in the history as a list for a field?
I think your are looking for "controls" visualization.
Go to visualization > controls
Then choose option list, your index and your field.
The result will be a dropdown with values like if you did a select distinct on your field within the whole kibana range.
Add it to a dashboard to have a filtering interface human usable dashboard.
Update:
Maybe a simple filter on the discover page can answer to your question.

Using a Content ID Contextual Filter in a Views Block in Drupal 8

I am attempting to create a View that, instead of showing a list of all nodes of a content type, will show only a single node of a content type based on node ID. In Drupal 7, I worked almost exclusively in Views Content Panes and was able to achieve this based on NID and then setting the Argument Input to From Context: Content ID. How do I get similar results using Blocks in Drupal 8?
I have a view that is correctly configured to show all nodes of a content type. I've tried to add a Contextual Filter: ID; but I cannot figure out how to configure it to get a result that isn't All Results.
Thank you in advance!
When you edit the contextual filter Content ID, you have :
WHEN THE FILTER VALUE IS NOT AVAILABLE (base view is built without filter, this is the case)
Check Provide default value to set how filter values should be retrieved, then you can choose a type, for example Content ID from URL, or Query parameter, etc.
For example with Query parameter you can set the parameter name and the Fallback value. In your case you would set something like nid as the query param, and all or a fixed node ID as fallback value ('all' is the exception value by default that is to disable the filter).
Given this example, you 'd just add the query ?nid=5 to the request path. It seems you need the block filtered by default though, in this case just set a fixed node ID (eg. 5 instead of all) as fallback value in views admin, then the block will be filtered by default the same way.

Fast query to retrieve those records that has published date

How do I query using Sitecore fast query to retrieve those records that has published date? I tried using the below but it did not return any value.
And how do I retrieve only the last node? Because when I use descendant::*, it will also return the parent out.
fast:/sitecore/content/test//[##parentid='{5656C582-A876-41E6-8441-A3F0BA0D2601}'
and #Publish>'20170101T000000']/descendant::
The Sitecore Field name for the publish field is not Publish. You need to make use of the following syntax for publish field: #__Publish.
You can see the right field name in the Inheritance from the template. You will be able to see the field names as shown below:
So, your query will looks as follows:
fast:/sitecore/content/Home//*[##parentid='{5656C582-A876-41E6-8441-A3F0BA0D2601}' and #__Publish > '20170101T000000']/*

Sort view based on weight of taxonomy vocabulary inside field collection

I got a view to list a content type (Say faculty). Among many fields, I have a field collection (Say position) which got a Designation field (Taxonomy Vocabulary).
Now I need an exposed filter criteria and sort criteria to sort the entire content based on this Designation inside this field collection.
By adding a relationship, I managed to apply the filter using "Designation", But I am unable to sort the content using the weight of this "Designation" taxonomy.
Note: Sort by taxonomy name is working. The problem is sorting with the weight of taxonomy.

Resources