You are viewing limited content. For full access, please sign in.

Question

Question

Adding a count on the number of entries in a folder structure

asked on March 1, 2016

Hi all,

I have a folder structure which is as follows

Is it possible to have a count on the number of entries (i.e. folders+ sub-folders + documents)found in the Finance folder. Is there a token that can be used to automatically show the number of entries such that the user does not have to further browse to sub-folders within the Finance folder?

Please see below screenshot to better understand my query.

Thus, Finance (10) folder represents a count on the number of folders found within Finance folder and folders / documents found within the 5 sub-section folders. Once a new folder has been placed under the Finance folder, the count on the number of entries should be automatically updated.

Please advise if this is feasible.

Kind Regards,

Sheila

0 0

Replies

replied on March 1, 2016

This is not currently possible, mainly due to the performance implications.

1 0
replied on March 2, 2016

Hi Robert,

Can you please elaborate on the "performance implications"? What would this incur?

Thanks

Kind Regards,

Sheila

0 0
replied on March 2, 2016 Show version history

The performance implications I was referring to are if the LF server supported this kind of thing out of the box. It would be a heavy load on the database. I think the Workflow idea is your best bet, but keep in mind that the paths to your documents will change if workflow updates the name of one of the parent folders.

0 0
replied on March 1, 2016

Actually as described this is pretty simple to do with a 3 part workflow that takes just a minute to setup and then conditional rule(s) to automate.

I don’t know if this is something you will want to implement but it works.  Had fun playing with it.

 

To set up the workflow you will need the entry id of the folder that you want renamed/updated with the count.  ( This can be found in the column headings of the repository display )

Next create a workflow with 3 parts: ( do not rename any of the activities )

1.  Search Repository

2. Second Search Repository

3. Rename Entry

In the first Search Repository activity enter for the search query:
{LF:Name="*", Type="DF"} & {LF:ID=XXXXX}
Replacing the XXXXX with the folder Entry ID value.

If you test this search it should only ever come back with one result, that of the folder that we will be renaming.   We are doing this first search so that the rename entry activity can key off of it and we are using the entry id because the folder name will be changing as the count changes.



In the second Search Repository enter the search query:
{LF:Name="*", Type="DF"} & {LF:LOOKIN="%(SearchRepository_FirstResult_FullPath)", SUBFOLDERS=1}
This will give us a token with the count of folders and documents of under our root directory.
 


In the Rename Entry activity:
Entry to Rename =  Other Entry -> Search Repository-First Result

(Be sure to use the output of the First Search, not the second! )

New Entry Name = <Folder Name>  (%(SearchRepository2_Result Count))

Where the <Folder Name> is the actual text name of your folder, if you were using "Finance":
Finance (%(SearchRepository2_Result Count))


Publish and run, your directory name should update with the count.

Add a document or folder and rerun, viola.

 

You could now add conditional rules to look for additions or deletions under the root folder that would run this workflow automatically.    Much like watching an __incoming directory for new files to process.
This would only work when items are added or deleted from the Finance folder itself, not the subfolders.
Optionally you could set this workflow up as a BP that could be ran when an updated count wanted to be seen.

( sorry I don’t have the graphics in my post,  this is my first answers post, hope it made sense! )

1 0
replied on March 1, 2016

If you pursue a solution like this, keep in mind that this counts entries that are visible to the WorkFlow service user.  Because of security, different users may have rights to see fewer entries than this.  This can be confusing to users and a security problem.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.