Miscellaneous
DeleteExternalFile()
Deletes an external file from the file system.
Parameter | Data Type | Description |
|---|---|---|
1* | Text | Full path of the file in the file system |
Examples
DeleteExternalFile("c:/test.txt") deletes the specified file if it exists.
Pause()
This pseudo-macro is used to artificially pause macro execution at the relevant point for testing purposes. This macro function does not return a result; rather, it leaves a target field at the current value.
Parameter | Data Type | Description |
|---|---|---|
1* | Number | Number of seconds for which processing is paused |
Examples
Pause(10) pauses macro processing for 10 seconds.
QueryDbRecord(), QueryDbRecords()
These functions perform a query to an external data source and assign the read values of the first record found to the desired target fields.
The QueryDbRecord() function only processes the first record found and typically assigns its content to header data fields. The QueryDbRecords() function reads in either all records or a specified number of records. Only item data fields can be used as the target here. A new item data row is generated from each data record read and appended to the existing target table.
Parameter | Data Type | Description |
|---|---|---|
1* | Text | Name of the property The command must be a SELECT query. When using an OLEDB or native SQL server connection, typed field variables in the form |
2* | Text or array | Name of a single target field or array of multiple target fields to which the values are assigned in the order they are contained in the record found To ignore values from the data set, elements in the target field list can also be left empty. With For the Sub-tables can also be addressed, but then, for the parent table, always specify the number of a concrete row that already exists:
|
3 | Bool | Boolean value determining whether a By default, the macro interpreter does not directly support the value NULL. Instead, empty values are used depending on the data type (e.g., an empty string By default, NULL values from the database are converted to an empty value that matches the source data type. If the NULL value is to be retained instead, the |
4 | Number | maximum number of data records that are to be extracted with By default, the number is not limited. |
Examples
QueryDbRecord("DBSelect1", ["Field1", "Field2"]) executes a database query that is configured under the name DBSelect1. This query can, for example, use the command SELECT [Column1], [Column2] FROM [Table1] WHERE [Column3] = @Field3 to filter for data records with the value of Field3. The values of Column1 and Column2 of the first data record found are assigned to the fields Field1 and Field2. If no data record is found, the target fields remain unchanged.
QueryDbRecords("DBSelect1", ["Items.Field1", "Items.Field2"]) creates a new row in the Items table for each data record found and assigns the values of Column1 and Column2 to the table fields Field1 and Field2 respectively, using the same database query as in the previous example.
SetDocMetaData()
This function sets a piece of metadatum of the current document to a given value. If an empty value is assigned, the existing metadatum is deleted.
Parameter | Data Type | Description |
|---|---|---|
1* | Text | Metadatum name |
2 | Text | Metadatum value |
Examples
SetDocMetaData("DocMeta1", "Value1") sets the value of the metadata DocMeta1.
SetFileMetaData()
This function sets a piece of metadata of an attachment that matches a defined name pattern to a defined value. If an empty value is specified, an existing metadatum may be deleted.
Parameter | Data Type | Description |
|---|---|---|
1 | Text | Name filter for the file attachment, whereby only the first attachment found is taken into account Default value: |
2 | Text | Restriction of the search to file attachments of a certain type (default value: all attachments) (optional):
|
3* | Text | Metadatum name |
4 | Text | Metadatum value |
Examples
SetFileMetaData("*.pdf", , "FileMeta1", "Value1") sets the value of the metadata FileMeta1 of a PDF file attachment.
WriteExternalFile()
This function writes the content of file attachments to external files in the file system.
Parameter | Data Type | Description |
|---|---|---|
1 | Text | Name filter for the file attachments, whereby all attachments found are processed Default value: |
2 | Text | Restriction of the search to file attachments of a certain type (default value: all attachments) (optional):
|
3* | Text | Path of the target folder in the file system Folders and subfolders that do not yet exist are created automatically. |
4 | Text | Name of the target file in the file system The name can be generated dynamically using file variables. If files already exist in the file system under the name in question, these files will be overwritten. Default value: |
Examples
WriteExternalFile("*.txt", , "c:/test", "%FileBaseName%.export.%FileExt%") writes all text file attachments under the existing name, supplemented by the suffix .export, to the file system.
WriteExternalFileFromField()
This function writes the content of a document field to an external file in the file system. Field contents that are not of the "Text" data type are converted into a text representation in the program's internal string notation.
Parameter | Data Type | Description |
|---|---|---|
1* | Text | Name of the field from the field catalog whose content is written to the file |
2* | Text | Path of the target folder in the file system Folders and subfolders that do not yet exist are created automatically. |
3 | Text | Name of the target file in the file system If a file already exists under the name, the existing file will be overwritten. |
4 | Text | Character encoding of the target file:
|
Examples
WriteExternalFileFromField("Field1", "c:/test", "export.txt") writes the content of the field Field1 as a text file export.txt to the file system.
DeleteFromCustomStore()
This function deletes a key/value pair that was previously persisted via the document macro function WriteToCustomStore() from the database.
Parameter | Data Type | Description |
|---|---|---|
1(*) | Text | Context information about the following key, if this alone is not clear enough or unique (optional) To delete all entries for a common context in one call, the context information can also be specified without a key. |
2* | Text | Key under which the value is stored |
Examples
DeleteFromCustomStore( , "CustomKey1") deletes the entry with the CustomKey1 key, if the key exists.
WriteToCustomStore()
This function writes a value to an internal database table used to persist custom data, independently of the administrative data generated by the program. However, the same database is used for this purpose, so this functionality is not available in database-less mode.
Parameter | Data Type | Description |
|---|---|---|
1 | Text | Context information about the following key, if this alone is not clear enough or unique (optional) |
2* | Text | Key under which the value is stored If an entry with this key (and possibly context) already exists, it will be overwritten. If no entry with this key exists, a new entry will be created. |
3* | (variable) | Value to be saved |
Examples
WriteToCustomStore( , "CustomKey1", "Value1") writes a value under the CustomKey1 key to the database.