Fetching folder paths in ACS Reports | Community
Skip to main content
New Participant
September 5, 2023
Solved

Fetching folder paths in ACS Reports

  • September 5, 2023
  • 2 replies
  • 858 views

Hi Team,

I want to fetch all folder paths under /content/dam/project of primaryType sling:Folder and nt:folder.

 

I have generated a custom ACS Commons Reports, in which I used this query SELECT * FROM [sling:Folder] AS folder WHERE ISDESCENDANTNODE('/content/dam/project');

I am not getting the fully generated report with this query, some folders are not included in the report which has primaryType as sling:Folder. So to avoid that, is there a way to set depth level of 7 on the result?

for example: we have paths like "/content/dam/project/level1/level2/level3/level4/level5/level6/level7", And I want all paths with this depth "/content/dam/project/level1/level2/level3/level4" and all folders under level 3 like "/content/dam/project/level1/level2/level3/a1",  "/content/dam/project/level1/level2/level3/a2" 

 

Any help through this is welcome.
Thanks.

@arunpatidar  @lukasz-m  @kautuk_sahni 

@SivakumarKanoori @Fanindra_Surat @Jagadeesh_Prakash @krati_garg @iamnjain @somen-sarkar @bajancherry @sunil_kumar_ @shelly-goel @Ganthimathi_R @davidjgonzalezzzz @krishna_garikapati  @Shubham_borole @milind_bachani @krishna_sai @manjunathdj  

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by aanchal-sikka

Hello @asritha 

 

You have mentioned that few sling:Folder are not listed. Can you please verify once, if your query is using a proper index.

If not, you might be receiving inconsistent results. 

 

Please try creating an index and verify the results.

 

Also, there is a predicate in querybuilder.

  • property.depth : The number of additional levels to search under a node. eg. if property.depth=3 then the property is searched till 3 level from base node. It is mostly used for nested search.

You can execute and check for its SQL equivalent in query logs

 

2 replies

aanchal-sikka
aanchal-sikkaAccepted solution
New Participant
September 5, 2023

Hello @asritha 

 

You have mentioned that few sling:Folder are not listed. Can you please verify once, if your query is using a proper index.

If not, you might be receiving inconsistent results. 

 

Please try creating an index and verify the results.

 

Also, there is a predicate in querybuilder.

  • property.depth : The number of additional levels to search under a node. eg. if property.depth=3 then the property is searched till 3 level from base node. It is mostly used for nested search.

You can execute and check for its SQL equivalent in query logs

 

Aanchal Sikka
EstebanBustamante
New Participant
September 5, 2023

Try the below query:

SELECT * FROM [nt:folder] AS folder WHERE ISDESCENDANTNODE('/content/dam/project') AND (folder.[jcr:primaryType] = 'sling:Folder' OR folder.[jcr:primaryType] = 'nt:folder')

This query selects all nodes of type "nt:folder" under "/content/dam/project" and filters them based on their primary type to include only those with "sling:Folder" and "nt:folder" as their primary types.

Esteban Bustamante
AsrithaAuthor
New Participant
September 5, 2023

Hey,

I wanted sling:Folder as primaryType and I was looking for a way to add depth of 7 on the folder paths.