Automation Action: Embedded Files Store
Save and query files using the embedded DB.
Save, get and delete files using the embedded document DB. ThinkAutomation includes an embedded server-less document database that you can use to store and retrieve files. See: Embedded Document DB Notes.
Database Name
Any number of separate databases can be created. Database names can contain letters or numbers only. You can use a %variable% replacement for the database name (all none alpha numeric characters will be removed during execution). Databases are global to the ThinkAutomation instance (IE: The same database can be used on all Solutions/Automations). A database is automatically created when it is first accessed.
Password
A database can be optionally assigned a password. If a password is specified then the database file will be encrypted with AES encryption. You cannot change a database password after it has been created.
Collection Name
A database can contain multiple collections. A 'collection' is similar to a 'table' in a traditional database. Collection names can contain letters or numbers only. You can use a %variable% replacement for the collection name (all none alpha numeric characters will be removed during execution).
Operations
Save
Save files to the database. You can specify specific local files or a %variable% containing a file path obtained from a previous action. You can also Include Incoming Attachments. For attachments you can specify a Mask (eg: *.pdf).
The Path In Database entry allows you to define a path within the database (similar to directories) where the files will be saved. This allows you to organize files within the database. You can use %variable% replacements in the path. For example: /Documents/%Msg_FromEmail%/
The Assign To variable will receive the saved file information.
Get
Read a previously saved file from the database and save it to a specified folder.
Specify the Path In Database for the file. For example: /Documents/Pdfs/Document1.pdf
Specify the Save To Local Folder path where the file should be saved. If Delete saved copy after message is processed is enabled then the saved file will be deleted after the Automation has completed for the current message. The file held in the database is not deleted - only the saved copy. This is useful if you need to access a file during an Automation (for example, to attach it to an outgoing message) but do not need it afterwards.
The Assign To variable will receive the local saved path (or blank if the file was not found in the database).
Delete
Delete a previously uploaded file from the database.Specify the Path In Database for the file. For example: /Documents/Pdfs/Document1.pdf
The Assign To variable will receive the deleted file path (or blank if the file was not found in the database).
Get Info
Gets file information for a previously saved file. The file itself is not read from the database.
Specify the Path In Database for the file. For example: /Documents/Pdfs/Document1.pdf
The Assign To variable will receive the file information (or blank if the file was not found in the database).
Get List
Gets a list of file information for a specified path.
Specify the Path In Database for the files. For example: /Documents/Pdfs/ - will return all documents starting with '/Documents/Pdfs/'. You can also use wildcards, for example: /Documents/Pdfs/Quotes*.pdf.
The file list can be returned as Json or CSV.
Drop Collection
Deletes all files in the specified Database / Collection.
The Assign To variable will receive the dropped collection name or blank if the collection does not exist.
File Information Format
The Save, Get Info and Get List operations return file information the following format:
{
"DatabaseName": "Attachments",
"CollectionName": "Files",
"Id": "$/Documents/Pdfs/Document1.pdf",
"Size": 116601,
"UploadDate": "2021-09-16T08:35:32.34+01:00",
"MimeType": "application/pdf"
}
A Json array will be returned for multiple files.
You can include the File Information %variable% in your Automation Return value. If the Automation has been executed from the Studio or Desktop Connector Send Message form then any File Information json will be automatically converted to clickable links. This will allow the user to save and view the file.
Get List CSV Option
The Get List operation can also return the list as CSV text, for example:
DatabaseName,CollectionName,Id,Size,UploadDate,MimeType
FilesStore,quotes,$/Documents/Quotes/Quote15.pdf,79467,2022-02-07 13:52:29,application/pdf
FilesStore,quotes,$/Documents/Quotes/Quote16.pdf,79467,2022-02-07 13:57:23,application/pdf
FilesStore,quotes,$/Documents/Quotes/Quote17.pdf,79468,2022-02-07 13:57:41,application/pdf
You could use the Set Variable action with the Convert CSV To Markdown Table if you wanted to include the list in the Automation return value to display a table.