Hey all,
OK, I played around with this, creating a temporary file cabinet, storing documents, then expanding a Text field.
First of all, "expanding the text field" is fairly tricky:
- I did not turn off any services for DocuWare, but I was not performing any administration on the file cabinet in question elsewhere.
- You need to expand the field in the base file cabinet table in the DWDATA database. You may be prevented from doing so due to an option that prevents table changes, so you will need to turn that option off. When I expanded a field, it said it was also modifying the accompanying SECT and VER tables. Not sure why, as they appear to be unchanged.
- You then need to change the "settings" XML field in the DWFileCabinet table (DWSYSTEM database):
- Modifying data in an XML column is a PAIN.
- You need to change the "dwLength" attribute of the UserField in question, and the "length" attribute of the UserField's "DBType" node (sample update queries later).
- All data is preserved; no index values were lost, since this is a same-type field expansion so nothing gets truncated or cast to a different type.
So, that leaves the XML header files stored in the file system. I noticed some interesting things there:
- When I initially store documents to the file cabinet, the length of the Text fields is not defined. The "length" attribute in the XML header file is "-1". (I am not sure if this changes if you have auto-fill indexes or if documents come in via an Import Configuration -- I just brought documents in via a manual Inbox process).
- If you change an index field (any index field) of a document, the user-defined Text fields switch to storing the field length for all of the user-defined index fields. After expanding a Text field, the new (higher) length is stored in the XML header files while all other header files are left alone, either in their initial -1 state or with the previous (lower) field length.
So, older XML header files definitely get out of sync with the newly-expanded structure. I do not know what issues that might cause when trying to recover from some sort of terrible failure where the file system files are all that remain of a file cabinet. But, expanding the field does not seem to be problematic from a DocuWare interface standpoint, and everything seems to work OK after an expansion.
Here is the SQL Server query to change the "dwLength" attribute of the UserField node in question:
UPDATE DWFileCabinet SET
Settings.modify('replace value of (/FileCabinet/Fields/UserField/@dwLength)[1] with "<expanded value>"')
WHERE (fid = <key of DWFileCabinet table>) AND (name = <Name of file cabinet, to be doubly sure>)
AND Settings.value('(/FileCabinet/Fields/UserField/@dbName)[1]', 'varchar(50)') = '<Database name of the expanded field>'
Here is the SQL Server query to change the "length" attribute of the UserField/DBType node in question:
update DWFileCabinet SET
Settings.modify('replace value of (/FileCabinet/Fields/UserField/DBType/@length)[1] with "<expanded value>"')
WHERE (fid = <key of DWFileCabinet table>) AND (name = <Name of file cabinet, to be doubly sure>)
AND Settings.value('(/FileCabinet/Fields/UserField/@dbName)[1]', 'varchar(50)') = '<Database name of the expanded field>'
As Phil says, do this at your own risk! And don't expect to be able to properly restore documents with the now-outdated XML header files should you ever find yourself in such dire straits!
Thanks,
Joe Kaufman