Prepending the Document Category to the Path
Some systems support Document Categories and others support Folders.
The SQL Script below will prepend the document category into the folder path.
- --When a document has a category, prepend the folder with the document category.
- UPDATE
__M_Documents_Digital_Files
SET
--Prepend the Category
Final_FolderName = CONCAT('\', V2.Final_Subject, Final_FolderName)
FROM
__M_Documents_Digital_Files V1,
__M_Documents_Digital_Categories V2
WHERE 1=1
AND V1.Final_DocumentCategory_Id = V2.Id
- --Only Prepend it where there is no folder
- AND Final_FolderName = '\'
- --Don't prepend the category if it has already been prepended.
- AND CHARINDEX(
- CONCAT('\', V2.Final_Subject, '\'),
- V1.Final_FolderName
- ) = 0
-
--Replace \\ with \
- UPDATE
- __M_Documents_Digital_Files
- SET
- Final_FolderName = REPLACE(Final_FolderName, '\\', '\')
Related Articles
Document Register: Moving digital documents into a Document Register Matter
/* This script is a template that will help you move library documents (document register / safe custody records) into a general 'Document Register' matter. You should consider this a TEMPLATE that you may want to tweak and adjust for each client's ...
Synthesize: Missing Document Categories for Documents
The following script will synthesize document categories for invalid Final_DocumentCategory_Id values on documents. -- Some documents are linked to categories that no longer exist. -- Create dummy document categories based on these values. INSERT ...
Matters: Prepending Client Names to Matters
The following script will prepend Client Names to Matter Names. For Example: Divorce 2016 would become John Smith --- Divorce 2016 Here is the relevant script: --Prepend all matter descriptions with the client name. UPDATE __M_Matters SET ...
Audit Scripts: General Audit
After completing a backup there are a number of things that are good to review prior to restoring into the destination system. The script below reviews several of the data points that should be looked at prior to restoring. This script is not ...
Synthesize Missing Matters for Documents
Some systems only allow documents to be linked to matters. These scripts will allow you to restore data into these systems. When Matters No Longer Exist The following script with synthesize matters for document related to matters that no longer ...