Stambia provides an option on the Write File Process Action that allows to prepend text at the beginning of a file.
In this article, we are going to see several examples and use cases of this functionality
Common usage
To write a line of text at the beginning of a file:
- Add a Write File Action in a Process
- Set the file's path
- Set the Txt Write Append parameter to 'before'
- Write your text in the body of the action
Example:
SQL File Export statistics and information in the exported file
The idea is to export data of a rdbms table to a file with SQL File Export, and then add at the beginning of the file:
- File's name
- Number of rows exported
Process Overview
As you can see, we first export the table and then write a header line containing the information retrieved with the help of Process variables.
Example of result:
Writing the result of a SQL Select
We have here the same goal as the previous example, but we want to add some more information about the execution.
More precisely, we want to add the result of a query.
Process Overview
We simply added a SQL Operation which executes a select statement, and we binded it to the write file.
Then, we are using the result with :{columnName}:
syntax.
Tip:
For more information on SQL Operations and binds, please refer to this this article.