How to find whether particular image rendition exists or not using query debugger or SQL2 query?

Avatar

Avatar

prajaktak281725

Avatar

prajaktak281725

prajaktak281725

11-06-2018

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?

rendition.png

Thanks,

Prajakta

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

aneeta45259594

Avatar

aneeta45259594

aneeta45259594

12-06-2018

Hi prajaktak28172563

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

Answers (6)

Answers (6)

Avatar

Avatar

aneeta45259594

Avatar

aneeta45259594

aneeta45259594

11-06-2018

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

Avatar

Avatar

prajaktak281725

Avatar

prajaktak281725

prajaktak281725

13-06-2018

Hi aneeta45259594,

Thanks for your help. It worked for me.

Avatar

Avatar

prajaktak281725

Avatar

prajaktak281725

prajaktak281725

12-06-2018

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

imagerendition.png

Thanks,

Prajakta

Avatar

Avatar

prajaktak281725

Avatar

prajaktak281725

prajaktak281725

12-06-2018

Hi aneeta45259594 and bsloki,

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

Avatar

Avatar

bsloki

MVP

Avatar

bsloki

MVP

bsloki
MVP

11-06-2018

Above query should work! Let us know if it didnt..

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

883

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

883
Arun_Patidar
MVP

11-06-2018

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