Knowledge Base

Managing Attachments Using Job Runner

Hint Ref: 021108160010
Hint Date: 16/08/2011

Hint Details:

When using Job Runner to manage Attachments, the commands vary depending on the type of Document.
For Microsoft Office documents, use the following :
- To load an attachment : <LoadOleBlobFromFile>
- To save an attachment : <SaveOleBlobToFile>

 

For other documents (PDF, Jpeg ...), use the following :
- To load an attachment : <LoadBlobFromFile>
- To save an attachment : <SaveBlobToFile>

Then when creating OleDocument records using jobrunner or scripts, it is essential that the fields RawFile and FileExtension are filled. 
If the document being stored is a Microsoft Office document then RawFile must be 0 otherwise it must be 1 (for .pdf, .jpeg etc.). 
FileExtension is what it says i.e. if the file is a pdf then it must contain 'pdf', doc then 'doc'. No dot required.

Examples
- For Microsoft Office Documents :
insert into oledocument (oledocumentid,description,ownertype,ownerid,rawfile,fileextension) values ('{blobid}','document title','C','{customerid}','0','doc')
- For other Documents : 
insert into oledocument (oledocumentid,description,ownertype,ownerid,rawfile,fileextension) values ('{blobid}','document title,'C','{customerid}','1','pdf')

This applies from 2.2.4.53 onwards.


(Please Note: This Procedure can be destructive and should only be used by Advanced Users.  RADical Systems (UK) Limited or its Partners cannot be held responsible, in anyway, for any consequence of using this or any other Database Function, Procedure or SQL command.  Responsibility resides solely with the user.  

IT IS HIGHLY RECOMMENDED THAT A FULL AND VALID SPACE MANAGER DATABASE BACKUP IS TAKEN AND VERIFIED AS VALID BEFORE MAKING ANY CHANGES TO THE DATABASE.)