Skip to content

Write To File – writing a file on the application server

The command "Write To File" writes text – or, decoded from base64, binary content – into a file in the file system of the application server. This page is for administrators who hand data to other systems through a shared folder.


1. At a glance

Purpose Create, replace or extend a file on the application server
Typical use Write an export into an exchange folder; keep a simple log file
Where in the editor Toolbar menu "Data" → "Write To File"
Needs a user interface No
Related Export Query, Iterate Files, Add File

This command writes to the file system of the server. To store a file with a record, use Add File.


2. Settings

The settings are on the tab "Settings". "Display Name", "Description" and "Execution Condition" are on the tab "General" (see Actions).

Setting Meaning Default / Required
"File Path" Expression for the absolute path of the file, for example /data/export/orders.csv. The folder must exist. Required
"Contents" Expression for what is written Empty: an empty file (or nothing is appended)
"Append Existing" Appends to an existing file instead of replacing it. A missing file is created. Off
"Decode Base64" Decodes the content from base64 and writes the bytes – needed for binary files such as Excel or PDF Off

3. Behaviour

  1. The expressions are evaluated.
  2. Without "Append Existing", an existing file is replaced.
  3. Text is written as UTF-8.
  4. With "Decode Base64" on, content that is not valid base64 is not written at all – the file stays as it was. The reason is written to the log.
  5. If the file cannot be written – the folder does not exist, the path is empty, the account has no rights – the reason is written to the log and the action continues.

The file is written with the rights of the account the application server runs under. In a container installation the path is inside the container; mount a folder of the host to reach it from outside (see Installation and configuration). With several servers, every server writes to its own file system unless the folder is shared.


4. Examples

Hand an Excel export to a file share.

  1. Export Query with "Output Format" XLSX writes into Export.
  2. "Write To File" with "File Path" /mnt/exchange/orders- followed by the date and .xlsx, "Contents" Export, "Decode Base64" on.

Append a line to a log file. "Contents" = the text of the line followed by a line break, "Append Existing" on.


5. Limitations

  • No error variable: whether the file was written is only visible in the log.
  • Folders are not created.
  • Text is always written as UTF-8; other encodings are not offered.