Function Block FS_WRITE_LIBFILE

The function block FS_WRITE_LIBFILE writes a file from the library to a file system.

Warning: Existing files are overwritten without warning.

The file system must have been initialized beforehand using FS_INIT. All operations are performed asynchronously per configured storage medium.

Note: To save File Attachments, a License is required.

Tip: For documents with high computational effort, create your own storage medium to generate multiple documents in parallel.

Input WRITE

A positive edge writes the file from the library to the storage medium.

Input DEV

Defines the device from which files are to be accessed. The device is used per project and can be managed in the context menu under Project External Storage.

Input PATH

Specifies the path to the file on the storage medium. The path corresponds to a Unix file path in UTF-8 format, if this is supported. The path is represented as follows:

Folder/Subfolder/File.txt

If this ends with a / or is a folder, the file name from the library is used.

Input LIB_FILE

Defines the file from the library. The input accepts only a direct string. The file can be dragged directly from the library to the input to define it.

Input LANG

Defines the language of the file. This must be present in the project.

Output DONE

The output returns a pulse on success to perform the next operation. The pulse occurs when the process ends, even if an error has occurred.

Output LENGTH

Returns the number of bytes written. The state is stored for later use.

Output ERROR

In case of an error, returns a text with an error message. This is FALSE if no error has occurred. The state is stored for later use.

Possible causes:

  • The service of the storage medium was not started.
  • The memory was not initialized.
  • The login credentials are invalid.
  • The remote server could not be reached.
  • The storage medium does not exist.
  • The specified path is invalid.
  • Writing to the storage medium is not possible.
  • No more storage space available on the memory or the memory is write-protected.
  • The library file is not online or is no longer available.
  • The specified language is missing or was not found.
  • No license to write the file is present.