Print Job Status Feedback

The application that provides data for label printing into Loftware Automation might expect to receive information about print job statuses. Feedback can be as simple as "All OK" in case of a successful print job generation, or detailed error description in case of an issue. Due to performance reasons, Loftware Automation disables feedback possibility by default. This ensures high-throughput printing as trigger doesn't care about the print process execution. The errors are logged to log database, but the trigger does not handle them.

You can also use this method to send feedback about other data the trigger collects. This can be status of network printers, number of jobs in the printer spooler, list of labels in a folder, list of variables in the specified label file, and many more.

Note

To enable feedback support from print engine, enable synchronous print mode. For more information, see section Synchronous Print Mode.

Enable print job status feedback using one of the two available methods.

Trigger provides feedback about print job status (Synchronous feedback)

Some triggers have built-in feedback possibility. If synchronous print mode is enabled, the trigger is internally aware of the job status. The client can send the data into trigger, keep the connection open and wait for the feedback. To use this feedback method, select and use a trigger type that supports providing feedback.

If an error happens with any of the actions, the internal variable ActionLastErrorDesc contains the detailed error message. You can send its value as-is or customize it.

For more information, see details about the respective trigger types.

  • Web Service Trigger: This trigger type supports feedback by design. The WSDL (Web Service Description Language) document describes details about the Web Service interface and instructs how to enable feedback. You can use the default reply that returns error description in case the print action failed. Or, you can customize the response and send back content of any variable. The variable itself can contain any data, including label preview or label print job (binary data).
  • HTTP Server Trigger: This trigger type supports feedback by design. Loftware Automation uses standard HTTP response codes to indicate print job status. You can customize the HTTP response and send back content of any variable. The variable itself can contain any data, including label preview or label print job (binary data).
  • TCP/IP Server Trigger: This trigger supports feedback, but not automatically. To make it deliver feedback, configure the data-providing client not to break the connection once the data is sent. After the print process completes, the next action on the list (Send Data to TCP/IP Port) might have the setting Reply to sender enabled. Provide feedback over the established still-open connection.

Action provides feedback about print job status (Asynchronous feedback)

In case of triggers that do not natively support feedback or in case you want to send feedback messages during the trigger processing, define an action that sends feedback to a selected destination. In this case, the data-providing application can close the connection as soon as the trigger data is delivered.

Example

You used the TCP/IP trigger to capture the data. The client dropped connection immediately after the data was sent, so we cannot reply over the same connection. In such cases, you can use another channel to send feedback. You can configure any of the outbound-connectivity actions, such as Execute SQL Statement, Open Document/Program, HTTP Request, Send Data to TCP/IP Port, and others. You would place such action under the Print Label action.

If you want to send feedback only for specific status, such as "error occurred", you can use the following methods.

  • Using condition on action: Print job status is exposed in two internal variables (ActionLastErrorID and ActionLastErrorDesc). The first one contains error ID or contains value 0 in case of no reported errors. The second one contains a detailed error message. Use values of these variables in conditions on actions that you want to execute in case of errors. For example, you would use the action HTTP Request after printing. The action would send feedback in if an error occurred. To enable such feedback, do the following:

    1. Open trigger properties.
    2. In ribbon group Variable, click the Internal Variables button and enable variable ActionLastErrorID.
    3. Go to Actions tab.
    4. Add the action Send Data to HTTP.
    5. Inside the action's properties expand Show execution and error handling options.
    6. For Condition, enter the following. The action with this condition executes only if an error occurs and ActionLastErrorID contains the error ID (any value greater than 0). By default, the conditions runs using VBScript syntax.
    7. ActionLastErrorID > 0
    8. You also have to enable the Ignore failure option on each action you expect to fail. This instructs Automation not to stop executing actions entirely, but to continue with the next action on the same hierarchical level. For more information, see Error Handling.
  • Using action Try: Action Try eliminates the need for coding conditions. The action gives you two placeholders. Placeholder Do contains actions that you want to run. If any error occurs when running them, the execution breaks, and actions in the On error placeholder are executed. You would use outbound-connectivity actions in this placeholder to provide a print job status feedback. For more information, see Try.