Folderish View with number of documents below

We have a document structure like this:

|-- Customer_ABC  
| |-- Project_1  
| |-- Project_2  
| | |-- Real_Document_4711  
| | `-- Real_Document_4812  
| `-- Project_3  
|     `-- Real_Document_987654  
|-- Customer_DEFG  
`-- Customer_HI  

Customer_X and Project_Y are Folders and Real_Document_123 are Files. Above is just an example, our structure is much more complex and has of course much more documents. But many folders are still empty and are waiting for real documents.

If you are looking in the WebUI to Customer A, you see all its direct successors (Project 1 to 3). Is there a way to configure the view to have an indication, e.g. a number in brackets, if a folder has any documents from type File below on any level?

I think of something like this; see the bracket behind the name with the number.

|-- Customer_ABC (3)  
| |-- Project_1 (0)  
| |-- Project_2 (2)  
| | |-- Real_Document_4711  
| | `-- Real_Document_4812  
| `-- Project_3 (1)  
|     `-- Real_Document_987654  
|-- Customer_DEFG (0)  
`-- Customer_HI (0)  

Or is such a calculation to expensive with NXQL?

0 votes

1 answers

692 views

ANSWER



Hello,

That's a use case I've already encountered. For this scenario:

  • I've created an automation chain to calculate the number of children with a query. The value is added in a custom property (I don't like to edit the title)
  • I've linked it to an event handler (each time a new content is added or removed from the folderish content

A better option would be to use the children content enricher (https://doc.nuxeo.com/nxdoc/content-enrichers/) and make a count on it: all you would need is to edit your layout then.

Cheers

0 votes



Hi Gregory:

Thanks for your input. Nice ideas!

Is your code available anywhere? That would speedup my development.

Thanks, Elmar

11/23/2022

After some thoughts I came to the conclusion that the first approach (adding a custom property) is not working.

The reason is because different users have different rights and therefore the counts will differ on their access right.

Does that make sense?

02/28/2023