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

Question

Question

Search for folders that do not contain a specific document

asked on January 21, 2015

I am building out a new departments folder structure and template.  They have asked me to define a search that will allow them to identify folders that do not contain a particular document.  The folder structure is as follows:

  • Parent Folder
    • Subfolder 1
      • Subsubfolder 1
        • Document 1
        • Document 2
      • Subsubfolder 2
        • Document 3
        • Document 4
        • Document 5 <--- Document in question
    • Subfolder 2
      • Subsubfolder 3
        • Document 6

 

In the above example I'd want the search results to return subsubfolder 1 and subsubfolder 3 since they did NOT contain the "Document in question".  I can either name the document "Document in question" or add a template field and apply it to the subsubfolder or the document.  

What is the best way to setup the data/ folders to achieve the desired results and what search syntax would I use?

0 0

Replies

replied on January 26, 2015 Show version history

Hello Amanda, 

 

Workflow would be a great way to accomplish this! One example is the workflow shown below. 

This is searching for all folders in the repository, then systematically working through them, identifying whether the document in question is contained within that particular folder. Once this process is complete, the results are sent in the form of an email.

 

The search syntax here is very straight forward.  In the first search repository activity, workflow looks for every folder: {LF:Name="*", Type="F"}. The second search repository activity looks for the entry in question; this can be done by searching for entry ID or the document’s name.

Once these searches are completed, a blank multi-value token is created. This is where the results will be stored. Then, a For Each Entry loop is created and targets the output from the first search repository activity. As it is looping through the folders, it uses a conditional sequence with the following criteria.

This looks at the folder’s contents and if the folder does not have a document with the name of the document in question, it is added to the results token.

I hope this helps! 

0 0
replied on January 26, 2015 Show version history

Hello Amanda! I believe we talked about this during the conference; I'm glad you brought it to Answers to see if anyone else has suggestions! I don't have any ideas beyond what we discussed at the conference, but here they are for reference:

1) If the document in question has the distinguishing information in the name, you can use the "ChildName" search and the NOT operator. For example, {LF:ChildName="Document 5"} would return subsubfolder 2, so if you combined it with a "Within Folder" search, like so:

{LF:LOOKIN="RepoName\Parent Folder"}-{LF:ChildName="Document 5"}

This would, however, return Subfolder 1 and 2 as well as Subsubfolder 1 and 3, so you would need to be more specific. Perhaps there is a field or template applied to the subfolders but not the folders, or a common naming scheme, like so:

{LF:Name="subfolder*"}-{LF:ChildName="Document 5"}


2) If you want to leave the distinguishing information in the metadata, the second option is to add the "Path" column and search for the documents themselves, then get the folder name from the path. For example, if the folders you wanted had contained only documents whose Status fields that was NOT equal to Closed, you could do the following search:

{[]:[Status]<>"Closed}

Then look at the last part of the Path in the Path column to get the folder names:

 

Edit: After looking over Kathryn's solution again, I have another suggestion: if this is a search that needs to be performed frequently, you might add a field on the folders you might need to return using workflow that indicates whether or not it has the specific document. For example, that field could be "Has Contract" and with values of True or False. When a document is added to the folders in question, Workflow could check if the document satisfies your metadata criteria, then modify the Has Contract field accordingly.

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

Sign in to reply to this post.