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_Folder_RelativePath = CONCAT('\', V2.Final_Subject, Final_Folder_RelativePath)
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_Folder_RelativePath = '\'
- --Don't prepend the category if it has already been prepended.
- AND CHARINDEX(
- CONCAT('\', V2.Final_Subject, '\'),
- V1.Final_Folder_RelativePath
- ) = 0
-
--Replace \\ with \
- UPDATE
- __M_Documents_Digital_Files
- SET
- Final_Folder_RelativePath = REPLACE(Final_Folder_RelativePath, '\\', '\')
Related Articles
Promoting Document Versions into Documents
--The following playbook is a TEMPLATE that you can use to promote all document versions into actual documents. --When a document has a category, append the folder with the document category ID. UPDATE __M_Documents_Digital_Files SET --Prepend the ...
Promote Document Version Notes to Document Notes
--The following script will promote document version notes --into document notes. This is useful when a destination system --supports notes on documents but does not support notes on --specific document versions. -- --If you are using this script, ...
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 ...
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 ...