Hi All,
I want to search for image nodes which don't have particular image rendition.
For example.,
Suppose I have a path as '/content/dam/mycompany/catalog/part'.
I want to find the images which don't have product-details.png rendition under rendition folder.
Can anyone please help me to get the SQL2 query or query using AEM query debugger?
Thanks,
Prajakta
Solved! Go to Solution.
Indeed the query I gave was an oversimplified one. It did give the results but not as refined.
To get the expected results, you don't really need to make the query as excessive as above.
Please try the query below
SELECT * FROM [dam:Asset] AS s where isdescendantnode([/content/dam/mycompany/catalog]) and s.[jcr:content/renditions/*] is not null and s.[jcr:content/renditions/product-details.png/jcr:primaryType] not like '%nt:file%'
This query basically checks if the renditions exist for an Asset AND any asset which might have the missing product-details.png rendition.
Best Regards,
Aneet
Views
Replies
Total Likes
Hi Prajakta,
You can do this with query debugger but for your requirement you need to create a custom predicate, which traverse through rendition node and check for product-detail.png
refer Is there way to know nodes without jcr:content node?
Thanks
Arun
Views
Replies
Total Likes
Hello prajaktak28172563
You can simply execute a query like below to get your results
SELECT * FROM [nt:file] AS s where isdescendantnode([/content/dam/mycompany/catalog/part]) and s.[jcr:path] NOT LIKE '%product-details.png%'
This query would automatically consider only renditions as nt:file is the nodetype being used.
I hope this helps.
Regards,
Aneet
Above query should work! Let us know if it didnt..
Views
Replies
Total Likes
I tried the query given by you but it's not returning any results.
My requirement is to find the image nodes which don't have product-details.png image rendition.
The logic in your query is saying to return all the renditions other than product-details.png which will not give the correct results.
Suppose one of the renditions folder has this rendition. Due to the above query, all the renditions other than product-details.png under that folder will be there in result which is not the requirement.
Thanks,
Prajakta
Views
Replies
Total Likes
Hi All,
I tried with the below query
select par.[jcr:path] from [nt:folder] As par WHERE ISDESCENDANTNODE(par, "/content/dam/mycompany/catalog/part/120/051/591") AND par.[jcr:path] not in
(select parent.[jcr:path] from [nt:folder] As parent Inner Join [nt:file] AS child ON ISCHILDNODE(child, parent)
WHERE ISDESCENDANTNODE(parent, "/content/dam/mycompany/catalog/part/120/051/591")
AND parent.[jcr:path] like "%jcr:content/renditions" AND child.[jcr:path] like "%product-details.png")
and got the error as
Thanks,
Prajakta
Views
Replies
Total Likes
Indeed the query I gave was an oversimplified one. It did give the results but not as refined.
To get the expected results, you don't really need to make the query as excessive as above.
Please try the query below
SELECT * FROM [dam:Asset] AS s where isdescendantnode([/content/dam/mycompany/catalog]) and s.[jcr:content/renditions/*] is not null and s.[jcr:content/renditions/product-details.png/jcr:primaryType] not like '%nt:file%'
This query basically checks if the renditions exist for an Asset AND any asset which might have the missing product-details.png rendition.
Best Regards,
Aneet
Views
Replies
Total Likes
Hi aneeta45259594,
Thanks for your help. It worked for me.
Views
Replies
Total Likes
Views
Likes
Replies