To learn more about filters in general, see section Understanding Filters.
Use this filter whenever a trigger receives non-structured data, such as documents and reports exported from legacy system, intercepted communication between devices, and captured print stream. The filter allows you to extract individual fields, fields in repeatable sub areas, and even name-value
pairs.
For examples of the structured text data, see sections Legacy Data, Compound CSV and Binary Files.
Defining Structure
The items you can use to configure the filter:
-
Field: Specifies the location of field data between field-start and field-end locations. There are various options to define the field location, from hard-coding the position to enabling relative placements. You must map the defined fields to respective variables in the Use Data Filter action. For more information, see section Defining Fields.
-
Sub area: Specifies the location of repeatable data. Each sub area defines at least one data block, which in turn contains data for labels. There can be sub areas defined within sub areas, which allows you to define complex structures. You can define fields within each data block. You must map the defined fields to respective variables in the action. For each sub area, Automation defines a new level of placeholder within the Use Data Filter action, so you can map variables to fields of that level. For more information, see section Defining Sub Areas.
-
Assignment area: Specifies the location of repeatable data containing the
name-value
pairs. Automation reads field names and their values simultaneously. Automation also automatically performs mapping to variables. Use this feature to accommodate filter to the changing input data, eliminating the maintenance time. You can define the assignment area at the root level of the document, or inside the sub area. For more information, see section Defining Assignment Areas.
Data Preview section simplifies the configuration. The result of a defined filter rule gets highlighted in the preview area along with every configuration change. You can observe which data items would be extracted with each rule.
The fields can be defined at the root level as document fields. The fields can be defined inside a data block. The name-value
pairs can be defined inside assignment area.
General
This section defines general properties of the unstructured data filter.
-
Name: Specifies the filter name. Use a descriptive name that identifies the role of the filter in a configuration. You can change it anytime.
-
Description: Allows you to describe the purpose of this filter. You can use it to write a short explanation about what does the filter do.
-
Encoding: Specifies the encoding of the data this filter works with.
-
Ignore empty lines in data blocks: Specifies not to raise errors if the filter extracts empty field values from the data blocks.
After you define a field, you have to define its name and rules for extracting field values from the data. When the filter executes, the extraction rules apply to the input data and assign result to the field.
Field Properties
-
Name: Specifies the unique name of the field.
-
Field has binary data: Specifies that the field contains binary data. Don't enable this option unless you really expect to receive binary data.
Field Start
-
Position in document: Hard-coded position in the data determines the start/end point. The coordinate origin is upper left corner. The character in the defined position is included in the extracted data.
-
End of document: The start/end point is at the end of the document. You can also define an offset from the end for a specified number of lines and/or characters.
-
Find string from start of document: Position of searched-for string defines the start/end point. After Automation finds the required string, the next character determines the start/end point. The searched-for string is not included in the extracted data. The default search is case sensitive.
-
Start search from absolute position: You can fine-tune searching by changing the start position from data-start (position 1,1) to an offset. Use this feature to skip searching at the beginning of data.
-
Occurrence: Specifies which occurrence of the search string should be matched. Use this option if you don't wait to set start/stop position after the first found string.
-
Offset from string: Specifies the positive or negative offset after the searched-for string.
Example 6. Example
You would define the offset to include the searched-for string in the extracted data.
-
Field End
-
Position in document: Hard-coded position in the data determines the start/end point. The coordinate origin is upper left corner. The character in the defined position is included in the extracted data.
-
End of document: The start/end point is at the end of the document. You can also define an offset from the end for a specified number of lines and/or characters.
-
Find string from start of document: Position of searched-for string defines the start/end point. After Automation finds the required string, the next character determines the start/end point. The searched-for string is not included in the extracted data. The default search is case sensitive.
-
Start search from absolute position: You can fine-tune searching by changing the start position from data-start (position 1,1) to an offset. Use this feature to skip searching at the beginning of data.
-
Occurrence: Specifies which occurrence of the search string should be matched. Use this option if you don't wait to set start/stop position after the first found string.
-
Offset from string: Specifies the positive or negative offset after the searched-for string.
Example 7. Example
You would define the offset to include the searched-for string in the extracted data.
-
-
Find string after field start: The start/stop end point is defined by the position of the searched-for-string as in the option Find string from start of document, but the search starts after the start position of the field/area, not at the beginning of the data.
-
Length: Specifies the length of the data in lines and/or characters. The specified number of lines and/or characters will be extracted from the start position.
-
End of the line: Sets the configuration to extract the data from the start position until the end of the same line. You can define a negative offset from the end of the line.
Formatting Options
This section defines string manipulation functions that apply on the selected variables or fields. You can select one or several functions. These functions are applied in the same order as selected in the user interface – from top to bottom.
-
Delete spaces at the beginning: Deletes all space characters (decimal ASCII code 32) from the beginning of a string.
-
Delete spaces at the end: Deletes all space characters (decimal ASCII value 32) from the end of a string.
-
Delete opening and closing character: Deletes the first occurrence of the selected opening, and closing characters that are found in a string.
Example 8. Example
If you use "{" for the opening character and "}" for the closing character, the input string
{{selection}}
converts to{selection}
.
-
Search and replace: Executes standard search and replace function upon the provided values for find what and replace with. You can also use regular expressions.
Note
There are several implementations of the regular expressions in use. uses the .NET Framework syntax for the regular expressions. For more information, see the Knowledge Base article.
-
Replace non printable characters with spaces: Replaces all control characters in the string with space character (decimal ASCII code 32). The non printable characters are characters with decimal ASCII values between 0–31 and 127–159.
-
Delete non printable characters: Deletes all control characters in the string. The non printable characters are characters with decimal ASCII values between 0–31 and 127–159.
-
Decode special characters: Special characters (or control codes) are characters that are not available on the keyboard, such as Carriage Return or Line Feed. uses a notation to encode such characters in human-readable form, such as <CR> for Carriage Return and <LF> for Line Feed. For more information, see section Entering Special Characters (Control Codes).
This option converts special characters from syntax into actual binary characters.
Example 9. Example
When you receive the data sequence "<CR><LF>", uses it as a as plain string of 8 characters. Enable this option to interpret and use the received data as two binary characters
CR
(Carriage Return - ASCII code 13) andLF
(Line Feed - ASCII code 10).
-
Search and delete everything before: Finds the provided string and deletes all characters from the beginning of the data until the string. The found string itself can also be deleted.
-
Search and delete everything after: Finds the provided string and deletes all characters from the string until the end of the data. The found string itself can also be deleted.
-
Change case: Changes all characters in your strings to uppercase or lowercase.
Sub area is a section of data that includes several blocks of data identified by the same extraction rule. Each data block provides data for a single label.
All data blocks must be identified by the same configuration rule. Each data block can contain another sub area. You can define an unlimited number of nested sub areas within parent sub areas.
If the filter contains definition of a sub area, the Use Data Filter action displays sub areas with nested placeholders. All actions nested below such placeholder execute only for data blocks at this level. You can print different labels with data from different sub areas.
Configuring Sub Area
The sub area is defined with similar rules as individual fields. Each sub area is defined by the following parameters.
-
Sub Area Name: Specifies the name of the sub area.
-
Data Blocks: Specifies how to identify data blocks within the sub area. Each sub area contains at least one data block. Each data block provides data for a single label.
-
Each block contains fixed number of lines: Specifies that each data block in a sub area contains the provided fixed number of lines. Use this option if you know that each data block contains exactly the same number of lines.
-
Blocks start with a string: Specifies that data blocks begin with the provided string. All content between the two provided strings belongs to a separate data block. The content between last string and the end of the data identifies the last data block.
-
Blocks end with a string: Specifies that data blocks end with the provided string. All content between the two provided strings belongs to a separate data block. The content between the beginning of data and the first string identifies the first data block.
-
Blocks are separated by a string: Specifies that data blocks are separated with the selected string of characters. All content between the two selected strings belongs to a separate data block.
-
-
Beginning of First Data Block: Specifies the starting position of the first data block. At the same time, it defines the starting position of the sub area. Usually, the starting position is also the beginning of the received data. The configuration parameters are the same as for defining fields. For more information, see section Defining Fields.
-
End of Last Data Block: Specifies the ending position of the last data block. At the same time, it defines the ending position of the sub area. Usually, ending position is at the end of the received data. The configuration parameters are the same as for defining fields. For more information, see section Defining Fields.
Configuring Fields Inside Sub Area
Fields inside the sub area are configured using the same parameters as fields defined at root level. For more information, see section Defining Fields.
Note
The field lines numbers refer to the position within data block, not position within the input data.
Data Preview
This section provides preview of the field definition. If the defined item is selected, the preview highlights its placement in the preview data.
-
Preview file name: Specifies the file that contains sample data that is going to be parsed by the filter. The preview file is copied from filter definition. If you change the preview file name, the new file name is saved.
-
Open: Selects another file upon which you want to execute the filter rules.
-
Refresh: Re-runs the filter rules upon the contents of the preview file name. Automation updates the Data Preview section with the result.
Unstructured Data filter automatically identifies fields and their values in the received data. This makes manual variable to field mapping unnecessary.
Dynamic structure functionality is helpful if the trigger receives data with changing structure. In such cases, main data structure remains unchanged (e.g., fields are delimited by a comma), or retains the same structure, but the order and/or the number of fields changes. There might be new fields, or some of the old fields could no longer be available. Because of enabled Dynamic structure, filter automatically identifies structure of the received file. At the same time, filter reads field names and values (name:value
pairs) from the data. This eliminates the need for manual mapping of fields to variables.
Use Data Filter action does not offer any mapping possibilities, because it performs the mapping dynamically. You don't even have to define label variables in the trigger configuration. The action assigns field values to the label variables of the same name without requiring the variables to be imported from the label. However, this rule applies to the Print Label action alone. If you want to use the field values in any other action, you have to define variables in the trigger, while still keeping the automatic variable-to-field mapping.
Note
There is no error if the field available in the input data doesn't have a matching label variable. NiceLabel Automation silently ignores the missing variables.
Configuring Assignment Area
The assignment area is configured using the same procedure as sub area. For more information, see section Defining Sub Areas. The assignment area can be defined on the root data level, appearing just once. Or it can be configured inside a sub area, so it executes for each data block in the sub area.
Configuring Fields in Assignment Area
When you create an assignment area, the filter automatically defines two placeholders. These two placeholders define the name:value
pair.
-
Variable name: Specifies the field whose content is taken as variable name (
name
component in a pair). Configure the field using the same procedure as for document fields. For more information, see section Defining Fields. -
Variable value: Specifies the field whose contents is taken as variable value (
value
component in a pair). Configure the field using the same procedure as for document fields. For more information, see section Defining Fields.
Example
The area between ^XA and ^XZ is assignment area. Every line in assignment area provides a name:value
pair. Name is defined as the value between 6th character in the line and equal character. Value is defined as the value between "equals" character and end of the line with negative offset of three characters.
^XA ^FD01DonationHR=G095605 3412625^FS ^FD02DonationBC=DG0956053412625^FS ^FD03HospitalNoHR=HN060241^FS ^FD04HospitalNoBC=060241^FS ^FD05Surname=Hawley^FS ^FD07Forename=Annie^FS ^FD09Product=Blood^FS ^FD10PatientBlGp=O Rh +ve^FS ^FD11DoB=27 June 1947^FS ^FD12DateReqd=25 Dec 2012^FS ^XZ