NiceLabel Automation uses filters to define structure of the data received by triggers. Each time a trigger receives data, one or many filters parse the received data. This process extracts relevant values for your configuration. Each filter includes rules to identify fields within received data.
Note
As a result, the filter provides a list of fields and their values (name:value
pairs).
Filter Types
For more information, see sections Structured Text Filter, Unstructured Data Filter, XML filter, and JSON Filter.
Data Structure
Filter complexity depends on the data structure. Files with structured data, such as CSV or XML files, make data extraction easy. In this case, field names are already defined by the data. Extraction of name:value
pairs is quick. In case of data without a clear structure, it takes more time to define the extraction rules. You might come across such data when exporting documents and reports from legacy systems, intercepted communication between devices, and captured print streams.
The filter defines a list of fields that are extracted from the incoming data once you run the filter.
NiceLabel Automation supports various types of input data that can all be parsed by one of the supported filter types. Make sure you select the correct filter to match the type of incoming data. For example, you would use Structured Text filter for incoming CSV data, JSON filter for incoming JSON data, and XML filter for incoming XML data. For any unstructured data, you would use Unstructured Data filter. For more information, see section Understanding Data Structures.
Extracting Data
Filter is a set of rules and doesn't do any extraction by itself. To run the filter, run the Use Data Filter action. This action executes filter rules against the data and extracts the values.
Each trigger type can execute as many Use Data Filter actions as necessary. If you receive compound input data that cannot be parsed by a single filer alone, define multiple filters and execute their rules using a sequence of Use Data Filter actions. Finally, use the extracted values from all actions on the same label.
Mapping Fields to Variables
To use the extracted values, you have to store them in variables. The Use Data Filter action does both – extracts values and saves them in variables. To configure this process, map each variable with the respective field. The value of the field is then saved in the mapped variable.
Tip
It's a good practice to define fields and variables with matching names. In this case, the auto-mapping feature links variables to the fields of the same names, eliminating the need for manual mapping.
Auto-mapping is available for all supported filter types. With auto-mapping enabled, the Use Data Filter action extracts values and automatically maps them to the variables with the same names as field names. For more information, see the section Enabling Dynamic Structure for Structured Text filter, Defining Assignment Area for Unstructured Data filter, and Defining Assignment Area for XML or JSON filters.
Running Actions with Extracted Data
Usually, you want to run actions using the extracted data, such as Open Label, Print Label, or some of the outbound connectivity actions. It is critically important that you nest your actions under the Use Data Filter action. This ensures that the nested actions are run for each data extraction.
Example 1. Example
If you have a CSV file with 5 lines, the nested actions also run for 5 times; once for each data extraction. If the actions are not nested, they only execute once and only contain data from the last data extraction. As for the example above, the 5th CSV line would be printed leaving out the first four lines unprinted. If you use Sub Areas, make sure you nest your action under the correct placeholder.