Save Data to File

This action saves variable value or other data streams (such as binary data) in a selected file. The Loftware Automation service must have write access to the defined folder.

File group defines the file to be opened.

  • File name: location of the file to be opened within this action.

    Path and file name can be hard-coded, and the same file is going to be used every time. If only a file name without path is defined, the folder with Loftware Automation configuration file (.MISX) is used. You can use a relative reference to the file name, in which the folder with .MISX file is used as the root folder.

    Data source: enables variable file name. Select a variable that contains the path and/or file name or combine several variables that create the file name. For more information, see section Using Compound Values in Loftware Automation User Guide.

If file exists group handles options in case of an already existing file.

  • Overwrite the file: overwrites existing data with new data. The old content is lost.

  • Append data to the file: appends variable values to the existing data files.

Content group defines which data is going to be written in the specified file.

  • Use data received by the trigger: original data as received by the trigger is going to be saved in the file. Effectively, this option makes a copy of the incoming data.

  • Custom: saves content as provided in the text area. Fixed values, variable values and special characters are permitted. To enter variables and special characters, click the arrow button to the right of the text area. For more information, see section Combining Values in an Object in Loftware Automation User Guide.

  • Encoding: encoding type for the sent data. Auto defines the encoding automatically. If needed, select the preferred encoding type from the drop-down list.

Action Execution and Error Handling

Each action can be set as a conditional action. Conditional actions only run when the defined conditions allow them to be run. To define these conditions, click Show execution and error handling options.

Execution options are:

  • Enabled: specifies if the action is enabled or disabled. Only enabled actions will execute. This functionality may be used while testing a form.
  • Condition: defines one-line programming expression that must provide a Boolean value (true or false). When the result of the expression is true, the action will execute. Condition offers a way to avoid executing actions every time.

Error handling options are:

  • Ignore failure: specifies whether an error should be ignored. If enabled, the execution of actions continues even if the current action fails.

    Note

    Nested actions that depend on the current action do not execute in case of a failure. The execution of actions continues with the next action on the same level as the current action. The error is logged but does not break the execution of the action.

  • Example

    At the end of printing, you might want to send the status update to an external application using the HTTP Request action. If the printing action fails, action processing stops. In order to execute the reporting even after the failed print action, the Print Label action must have the option Ignore failure enabled.

  • Save error to variable: allows you to select or create a variable to save the error to. The same cause of the error is also saved to internal variables ActionLastErrorId and ActionLastErrorDesc.