Overview
Advanced Data Formatting is a powerful rule driven data editor within Zebra scanners. Rules are programmed within the 123Scan utility with a GUI based wizard that generates code in a unique interpreted ADF language. This code is loaded into the scanner and the ADF interpreter processes acquired decode data before it is transmitted to the attached host device. The 123Scan utility provides descriptions of the criteria and actions available in the ADF language. Most of the functionality within ADF is easy to understand and apply. This document provides additional details of the powerful ADF features that can be used to customize your scanner to meet your company's changing IT requirements.
Terminology
ADF Interpreter
Software that runs on the Zebra product that interprets ADF Rules after decode data is read and before the data is transmitted.
ADF Rule Formats
The format of ADF Rule data as it is stored in the scanner's Flash memory. 2000 bytes of rule storage is available on the scanner. The legacy versions of ADF (called ADF1 Format) limits the size of a rule to 127 bytes. This includes the criteria and action sections of a rule. The latest version of ADF (called ADF2 Format) limits the size of a rule from 310 to 670 bytes depending on the number of criteria sections. Refer to Highlights of ADF Features for more details on multiple criteria sections.
The current ADF Interpreter supports both Rule Formats, but only one format can be used at a time. If one rule is saved in the legacy format, then only rules of that format can be added.
Boolean Logic
Boolean Logic is a form of Mathematics that is centered on values that are either TRUE or FALSE. Each Criterion in a rule has a TRUE or FALSE value. Boolean Operators are used to show how the criteria are related to each other. When a Boolean Operator is applied, it has a TRUE or FALSE result.
Table 1: ADF Interpreter Supported Boolean Operators
| Operator | Example | Meaning |
|---|---|---|
| NOT | NOT Code 39 | If the criterion is FALSE, the NOT changes it to the TRUE result |
| AND | Length 14 AND Starts with “A” | If both criteria are TRUE, the result is TRUE. Otherwise the result is FALSE |
| OR | Length 8 OR Length 10 | If one of the criteria are TRUE, the result is TRUE. Otherwise the result is FALSE |
| AND NOT | Length 10 AND NOT Starts with “C” | If both the left criterion is TRUE and the right criterion is FALSE, the result is TRUE. Otherwise the result is FALSE |
| OR NOT | Upc-a OR NOT ends with “X” | If either the left criterion is TRUE or the right criterion is FALSE, the result is TRUE. Otherwise the result is FALSE |
Hexadecimal Numbers
In Mathematics, Hexadecimal numbers can be used to represent a number from 0 to 255 in two digits. Each hexadecimal digit has a value from 0 to 15 (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) The letters A to F are used to represent the values 10 to 15 respectively. In a two digit Hexadecimal number, the left digit is also from 0 to 15, but its value is assumed to be multiplied by 16.
In this document hexadecimal numbers are displayed with a back-slash \ followed with an “x” and two digits. For example: the hexadecimal number \x12 has the decimal value of 18 (1x16 + 2).
Highlights of ADF Features
ADF rules are programmed using a Graphical User Interface based utility.
|
|
The 123Scan utility is the recommended way to program rules into the scanner. Depending on your product configuration, the utility can generate the correct ADF rule structure for your product. Once rules are entered into the utility, they can be uploaded to your scanners directly. As an alternative, barcodes can be printed to enter the same rules through scanning. |
|
|
The legacy barcode menus in this document can still be used to program rules into the scanner. Not all ADF features are supported in the legacy ADF Programmer's guide. |
ADF can be used to process barcode data of any length and prepare it for transmission to a host device.
The ADF Interpreter’s main function is to use rules to process the scanned bar code data in an input buffer and to move selected data to an output buffer. Each rule has a “criteria” section that describes the requirements for the rule to apply. If the rule applies, the rule’s list of actions is used to process the input buffer’s data. The results of the rule’s actions are stored in an output buffer. This output buffer data is transferred to the connected host device.
The legacy ADF Interpreter (called ADF1) is designed to work optimally with barcodes up to 255 bytes in length. When a barcode is longer, ADF1 can process these barcodes, but it may require multiple actions to move data or move the cursor 255 characters at a time.
To improve the operation of ADF, the latest version of ADF (called ADF2) has an “Full String Length” feature that allows the easy processing of barcodes up to 4096 bytes in length. This feature is enabled by default and it can be disabled in the General Settings section of 123Scan for each rule.
ADF Rules are processed in the order in which they are stored.
The ADF rules built in 123Scan are transferred to the Scanner and stored in the scanner’s Flash based storage.The order that ADF rules are stored is significant. The first rule that applies is the one that is chosen to process the input data.
General vs. Specific Rules
Rules with more stringent criteria are called “Specific Rules”, Rules that apply in most cases are called “General Rules”.
When assembling rules for your device, be careful to put the more specific rules higher on the list. When a “General Rule” is placed on the rule list above a more “Specific Rule” it has the effect of cancelling out the rules that follow it.
For example: Here is a list of rules that is more specific at the top, and more General at the bottom.
| Rule List (Criteria sections only) | |
| Specific Rules | When the connected Host is IBM RS485 and barcode is UPC |
| When rule set 1 is enabled and barcode is QR Code starting with “STOP” | |
| When a barcode begins with “GPC” and is length 12 | |
| When a barcode contains “XYX” in any location | |
| When a barcode is Code 128 Length 10 | |
| When a barcode is UPC | |
| When a barcode contains only Numeric data | |
| When a barcode is decoded in handsfree mode | |
| General Rules | When any barcode is scanned |
It is subjective on how “Specific” a rule is. When editing the rules in 123Scan, consider the rule order based on how the rules need to be applied.
All About Cursors
Similar to viewing data in an editor, ADF starts with a cursor on the starting position of the data. As actions are performed on the data, the cursor is moved forward or backward based on the actions used on the rule.
The ADF Interpreter uses a cursor to mark the next character to be processed by the next action. The image below shows a “data terminal” screen, and the cursor is on the “C” character in the word “Cursor”
As actions are processed, the cursor is moved forward for every character sent. So if the rule says to send data up to space (“ “), then the word Cursor is sent and the cursor is moved to the letter “p” of points.
In cases where the data needs to be skipped, ADF provides several Actions to move the cursor to a new position.
ADF Rules require that the data matches the rule.
When a rule is selected by the ADF interpreter due to matching criteria, then the Action section is applied. Actions will traverse the input data like a word processing application. A cursor is maintained that points to where the next action will process data.
Actions in the rule can move the cursor forward or backward a specified number of positions, or until a matching character or pattern is seen. If an action requests to move to a place in the data that does not exist, then the rule is said to have an “Action Failure” (See Failure Recovery for details).
ADF Rules build Output Data to be transmitted.
In summary, ADF is configured by writing one or more rules using the 123Scan2 graphical interface. These rules are transmitted to the scanner and stored in its Flash memory. When a barcode is scanned these rules are checked to see if a rule is found that would apply to the data.
Later on, when a barcode is scanned, the ADF Interpreter is called on the scanner to format the input data. The rule creates a buffer of Output Data. This data is handed off to the driver for the attached host device and the data is transmitted.
Understanding Criteria Within a Rule
Each ADF rule has a Criteria section that defines the types of barcode data that applies to a rule. The latest version of ADF has some improved capabilities in the Criteria section. These improvements provide a more powerful way of customizing the scanner.
The Criteria section defines the conditions required for a rule to apply to scanned data.
Each rule provides a list of criteria to determine if a specified set of actions should be applied to a barcode that is scanned. ADF provides several criteria to choose from when building a rule.
- The source of the data
- The length of the data
- The type of barcode data scanned
- The contents of the data
- The means that the barcode scanner was triggered to read the data
- The connected host that will receive the data
- The rule is presently enabled or disabled using a Rule Set
ADF uses Boolean Logic to evaluate each of the criteria and determine if the rule applies. The ADF Interpreter will assume there is an AND or OR relationship between each criterion. 123Scan will automatically assign this relationship based on these requirements:
- When more than one criterion of the same name follows another, they are assumed to have the OR relationship. (e.g. Length = 5 OR Length = 6 OR Length = 12)
- When more than one criterion of a different name follows another, they are assumed to have the AND relationship. . (e.g. Code 39 AND Starts with “A”)
For example: The user wants a rule that applies when a code 128 barcode starts with XJT, MWX, or LKT. In this simple case, the ADF interpreter applies the following Boolean Operators according to its requirements.
The user can override the ADF Interpreter’s requirements by Manually inserting Boolean Operators between criteria to implement really special cases. See Tips for Power Users of ADF for more information.
Getting to know the Criteria supported in ADF.
Checking the Length of Scanned Data
ADF allows the checking of discrete lengths, lengths within a range, lengths below a value, lengths above a value. To illustrate length checking we have some sample barcodes:
The following are examples of what could be programmed in an ADF rule and the lengths of barcodes that would cause the rule to apply.
| Length checking type | Criteria | Length 8 | Length 10 | Length 12 |
|---|---|---|---|---|
| Discrete lengths | When length equals 10 or 12 | ✔ | ✔ | |
| Lengths within a range | When length in range 8 to 11 | ✔ | ✔ | |
| Lengths below a value | When length is below 10 | ✔ | ||
| Lengths above a value | When length is above 10 | ✔ |
Checking the Type of Barcode Data Scanned
ADF can check the symbology type of barcode that was scanned. Zebra scanners can support many barcode types, and more than one symbology type could require similar formatting. ADF allows multiple code symbology types to apply to a rule.
To illustrate symbology type checking we have some sample barcodes:
The following are examples of what could be programmed in an ADF rule and the types of barcodes that would cause the rule to apply.
| Symbology checking type | Criteria | UPC-A | Code128 | QR Code |
|---|---|---|---|---|
| Single Code Type | When Code Type is UPC-A | ✔ | ||
| When Code Type is Code 128 | ✔ | |||
| When Code Type is QR Code | ✔ | |||
| When Code Type is Code 128 OR Code 39 | ✔ | |||
| Code Type Group | When UPC/EAN | ✔ |
Looking for Patterns of Data Within Scanned Barcode Data
ADF can check for patterns of data within the scanned barcode: At the start, at the end, at a specific position in the data, or in any position. Position numbers start with 1 at the first character of the scanned barcode data.
The following are examples of what could be programmed in an ADF rule and the types of barcodes that would cause the rule to apply.
| Pattern matching type | Criteria |
|---|---|
| Starts With | When starts with “187” |
| At a specific position | When “-“ is at position 4 |
| Ends With | When ends with “ICE” |
| In Any Location | When “ABC” is anywhere |
Format Differently Depending on the Connected Host
One way of detecting where the scanner is used is by the type of host that it is connected to. The host connection type could be used to automatically select rules. This can be handy if one workstation used a USB connection and the same scanner can be plugged into another workstation with a RS232 connection. ADF rules can identify the type of Host connection that they belong to. If the rule does not apply then it is skipped. Actions within the rules can easily strip out certain non printable or alphabetic characters to suit one host.
Use the scanner’s Buttons to Select What Rules to Run
Zebra scanners support a variety of methods to trigger the reading a barcode. One scanner model has 2 buttons available to scan data. A rule could be programmed to format the data differently depending on how the decode was triggered.
One example is to use one trigger button to “add” an item and put it in the cart, and the other button to “remove” items from the cart. Data could be added to decode data depending on which button was used.
Rules Can Ignore Barcodes that Contain Unwanted Data
When processing data, sometimes the data has special characters or un-printable characters that are not applicable. ADF has a criterion that can be used to select the types of ASCII data that are allowed for a rule to apply. (see Appendix: ASCII Type Classification for a list of ASCII values and their default character type).
ADF supports the recognition of these types of ASCII data:
- NON-PRINT - Non Printable ASCII value
- WHITESPACE - Tabs, Spaces, Line Feeds, Vertical Tabs, Carriage Returns
- NUMERIC - Values 0 to 9
- ALPHA - Values A to Z and a to z
- OTHER - ASCII values greater than 127
- SPECIAL - Everything else (for example: !@#$%^&*()_+)
- CUSTOM - A list of 1 to 16 ASCII characters that the user can select for a rule.
See Tips for Power Users of ADF for details on defining a custom character set.
A criterion can be added to a rule to select one or more ASCII categories that are allowed to be in the input data for the rule to apply. All of the selected ASCII categories must be represented in the barcode for the criterion to be TRUE.
The following barcode contains three categories: Numeric, Alphabetic, and Special.
For example, using this barcode, a criterion can be used in a rule that requires all three of these categories of data to match: When Scan data includes NUMERIC, ALPHA, SPECIAL
The barcode contains all three categories of data, so the criterion evaluates to TRUE.
The following barcode contains three categories: Numeric and Alphabetic.
Using the same rule, the criteria When Scan data includes NUMERIC, ALPHA, SPECIAL would evaluate to FALSE.
Rules Can Be Disabled or Enabled
ADF has a mechanism to enable or disable one or more rules at a time using Rule Sets. There are eight numbered Rule Sets supported by ADF and each rule can optionally be assigned to a Rule Set number using the Rule Set member criteria.
“This rule belongs to Rule Set x”
Each numbered Rule Set has a status, it is either enabled or disabled. All are disabled by default when the scanner powers up.
When a Rule Set is disabled, then the ADF Interpreter will skip all the rules that are a member of that rule set. When a rule is not assigned to a Rule Set, then the Rule is always Enabled.
For example, if a scanner has the following rules stored in the ADF Rule buffer. And the status of the eight Rule Sets are as shown above, then the shaded rules are skipped.
More details on this feature can be found in Tips for Power Users of ADF.
Building your Output Data with Actions
Each ADF rule has an Action section that defines how the decoded barcode data is processed before it is transmitted to the attached host. The latest version of ADF has some improved capabilities in the Action section. These improvements provide a more powerful way of customizing the scanner.
Changing Input Source
A new aspect of ADF is that it supports multiple data sources. When barcode data is scanned, the initial input source is the barcode data (shown with blue arrow). However, actions are available to change the input source for the rule to either a User Defined String, or to Asset Tracking Information (shown with white arrows).
Each input source has its own cursor. When the rule switches to User Defined String data or Asset Tracking Information then the cursor starts at the beginning of this data, however the barcode data cursor position is retained. When the input source is switched back to barcode data, ADF continues where it left off.
The next two sections provide examples of Input Source changing in use.
Send a large block of data
Sometimes the rule needs to append a large amount of data to the Output Data. For example, some printers require a lot of data to configure them. ADF rules can hold large user defined strings of printer configuration data, up to 128 bytes. Once in the rule, ADF actions can be used to parse the data to send in whatever format required.
The following is an example of “scan and print”. In this example, the string “^XA^XFE:BARCODE.ZPL^FS^FN11^FD” precedes the data to print and the string “^FS^PQ1^XZ” follows the data. A 2D barcode with a large amount of text is scanned. The blue arrows show the position of the cursor after each action.
Identify which scanner was used in collecting data
What if your process needs to know which scanner read a shipping barcode for its records. ADF can be programmed to transmit the scanner's model number or serial number with the needed data on the shipping label. This could be a way where the clerk's station could be identified
In this scenario, an Inventory taker is reading tags on units. This rule would send the model and serial number of the scanner followed by the inventory tag. The blue arrows show the position of the cursor after each action.
Actions that Provide User Feedback
Your business may use a process that requires the scanning of multiple barcodes and some User Feedback might help in the support of this process. ADF rules can be setup to adjust the LED lighting on the scanner, or to sound a beeper sequence or vibrate the scanner handle when a certain data pattern is seen. The vibrations can be in multiples so that they can stand out to the user.
For example, when a specific barcode is scanned (based on data contents) the scanner can give a single vibration and light the Green LED on the top of the scanner. And when incorrect data is scanned a Red LED can be lit and a triple vibration can be felt on the handle.
Beep Indication
An action can be used to sound a beeper sequence. The beeper sequence occurs when ADF processes the input data, before the output data is transmitted.
The following list shows all the available sequences.
- 1 to 5 High Frequency Tones of Short Duration
- 1 to 5 Low Frequency Tones of Short Duration
- 1 to 5 High Frequency Tones of Long Duration
- 1 to 5 Low Frequency Tones of Long Duration
- High-Low-High-Low Frequency, Short Duration
- High-Low-High-Low Frequency, Long Duration
- 2 Tones High-Low Frequency, Short Duration
- 2 Tones Low-High Frequency, Short Duration
- High-Low-High Frequency, Short Duration
- Low-High-Low Frequency, Short Duration
- High-High-Low-Low Frequency, Short Duration
LED Indication
An action can be used to illuminate an LED, usually on the top of the scanner with a specified color for a number of seconds (From 1 to 10). Not all scanners support all colors. The LED sequence occurs when ADF processes the input data, before the output data is transmitted.
If the LED to illuminate is not supported by the scanner, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Vibrate Indication
An action can be used to vibrate the scanner handle in a special way by ADF rule. This only applies to scanners with vibration capability, such as Healthcare models.
Moving the Cursor through the Input Data
Skip to Start
This action moves the cursor to the first character of the input data.
Skip Ahead
This action moves the cursor ahead the specified number of characters.
The following example shows the processing of a Code 128 barcode. The blue arrows show the position of the cursor after each action.
If the requested move goes beyond the end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Skip to End
This action moves the cursor to the last character of the input data. When on the last character, a send action will process the last character only
Skip Back
This action moves the cursor back the specified number of characters.
The following example shows the processing of a Code 128 barcode. The blue arrows show the position of the cursor after each action.
If the requested move goes beyond the start of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Skip to Position
This action moves the cursor to a specific position in the input data. If the requested move goes beyond the end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Skip Back to Position
This action moves the cursor to a specific position in the input data relative to the end of the input data.
The following example shows the processing of a Code 128 barcode. The blue arrows show the position of the cursor after each action.
If the requested move goes beyond the start of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Move to Character
This action moves the cursor forward until a matching character is reached. The matched character is treated like a delimiter, so it is skipped. Upon a match, a forward search will place the cursor a character after the matched character.
The following example shows the processing of a Code 128 barcode. The blue arrows show the position of the cursor after each action.
If the character to match is not seen up to the start or end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Move Past Character
This action moves the cursor forward until it no longer points to the specified character. This can be used to strip out strings of padding data anywhere within the input data.
The following example shows the processing of a Code 128 barcode. The blue arrows show the position of the cursor after each action.
Move to Pattern
This action moves the cursor forward until a matching string is reached. Upon a match, a forward search will place the cursor a character after the matched string.
The following example shows the processing of a Code 128 barcode. The blue arrows show the position of the cursor after each action.
If the string to match is not seen up to the start or end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Move Back to Pattern
This action moves the cursor backward until a matching string is reached. Upon a match, a reverse search will place the cursor at the first character of the matched string.
The following example shows the processing of a Code 128 barcode. The blue arrows show the position of the cursor after each action.
If the string to match is not seen up to the start or end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Move to Character from End
This action moves the cursor backward until a matching character is reached. Upon a match, a reverse search will place the cursor a character after the position of the matching character.
The following example shows the processing of a Code 128 barcode. The blue arrows show the position of the cursor after each action.
If the character to match is not seen up to the start or end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Editing Input Data Before it is Sent
When barcode data is scanned, ADF holds this input data in a buffer. This data can be modified immediately by certain actions and retained in this buffer before the data is sent.
In ADF1, these modifications are retained if the current rule fails and exits due to an action failure. This means that the next rule that processes this input data will have whatever data is modified by the previous rule.
In ADF2 this side effect is eliminated by default. Each rule starts with the originally scanned data. This “Undo Changes” setting can be turned off by disabling the “Undo Changes” setting in the General settings section of 123Scan. This side effect can also be avoided by selecting “Ignore Failed Actions” or Partial Actions, aka “Do what you can when an Action Fails” in the General settings section of 123Scan.
Erase First N Characters
This action deletes the specified number of characters starting at the current cursor position. If the requested deletion goes beyond the end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure. The cursor does not move. The blue arrows show the position of the cursor after each action.
Erase First N Characters from End
This action deletes the specified number of characters starting at the end of the data. If the requested deletion goes beyond the start of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure. The cursor is moved to the end of the input data. The blue arrows show the position of the cursor after each action.
Remove Leading Characters
This action removes all leading instances of the selected character from the input data. The cursor is moved to the start of the data, and as long as the cursor is pointing at the specified ASCII character, it is removed from the input data. Once the cursor points to a character other than the specified character, the action is complete. The blue arrows show the position of the cursor after each action.
Remove Trailing Characters
This action removes all trailing instances of any specified ASCII character from the end of the input data. In the removal process, the cursor is moved to the last character of the data, and as long as the cursor is pointing at the specified ASCII character, it is removed from the input data. Once the cursor points to a character other than the specified character, the action is complete. The cursor is set to the start of the data at the end of the process. The blue arrows show the position of the cursor after each action.
Delete First Pattern
This action looks for a specified string within the input data starting at the current cursor position. This string is removed from the input data. The blue arrows show the position of the cursor after each action.
If the string to match is not seen up to the end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Delete All Patterns
This action looks for a specified string within the input data starting at the current cursor position. This string is removed from the input data. This deletion is repeated for every instance found in the input data. The blue arrows show the position of the cursor after each action.
If the string to match is not seen up to the end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Replace First Pattern
This action looks for a specified string within the input data starting at the current cursor position. This string is removed from the input data and it is replaced with another string. The cursor is moved to a character after the replaced string. The blue arrows show the position of the cursor after each action.
If the string to match is not seen up to the end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure.
Replace All Patterns
This action looks for a specified string within the input data starting at the current cursor position. This string is removed from the input data and it is replaced with another string. This replacement is repeated for every instance found in the input data. If the string to match is not seen up to the end of data, this causes an “Action Failure”. See the “General Settings” section in 123Scan to select how to respond to this failure. The blue arrows show the position of the cursor after each action.
Trim Data Outside Positions
This action will trim the input data to be a substring of the original data. The start and end position within the scanned input data is selected and ADF will trim off the data before and after the set range. This trimmed data is used for the rest of the rule's execution. If the cursor is within the trim range, then the cursor is not changed, otherwise the cursor is set to the start of the trimmed data. The blue arrows show the position of the cursor after each action.
Modifying Output Data While it is Sent
ADF provides several options to filter and modify barcode data before it is sent out. These options are configured in advance in the rule and they take effect when a request is made to send data (Send All Data, or Send Data up to Char X, or Send next N characters of data). The input data is not changed by these actions.
Remove all Leading Spaces
ADF has actions available to remove leading spaces in the front of the Output Data. When enabled, every send data request will have its leading spaces removed.
For example, if a QR barcode has three fields of data contained in it, all starting with leading spaces, ADF can strip the leading zeros off for each field (“□” shows a Space in input data). The blue arrows show the position of the cursor after each action.
Crunch all Spaces
ADF has an action called “Crunch Spaces” that will shorten any blocks of multiple spaces to a single space within the Output Data.
For example, if a PDF417 barcode contains several 12 byte fields of data, but the spacing of the data is not needed, ADF can strip the extra spaces out when the data is transmitted. (“□” shows a Space in input data). The blue arrows show the position of the cursor after each action.
Stop Space Removal
The ADF Interpreter can be directed to stop removing spaces within a rule. All the send actions that follow in the rule will not have leading spaces removed.
For Example, the QR barcode has fields padded with spaces (“□” shows a Space in input and output data). In this case only the first field has leading spaces removed. The blue arrows show the position of the cursor after each action.
Remove All Leading Zeros
ADF has actions available to remove leading zeros in the front of the Output Data. When enabled, every send data request will have its leading zeros removed.
For example, if a Code 128 barcode has three fields of data contained in it, all starting with leading zeros, ADF can strip the leading zeros off of each field. The blue arrows show the position of the cursor after each action.
Stop Leading Zero Removal
The ADF Interpreter can be directed to stop removing zeros within a rule. All the send actions that follow in the rule will not have leading zeros removed.
The following example has a Code 128 barcode, and the first field of data has zeros stripped, but the field that follows does not. The blue arrows show the position of the cursor after each action.
Pad Data with Spaces to a Specified Length
This action can be used to direct the ADF Interpreter to pad each following send actions to a specified length by adding leading spaces. If the data to be sent is longer than the requested length, then no spaces are added.
For example, three fields of data are separated with commas in the input data. This rule can replace the delimiter with fixed width fields with space padding. (“□” shows a Space in output data). The blue arrows show the position of the cursor after each action.
Stop Pad Spaces
The padding with spaces can be stopped within a rule. Here is the previous example, stopping the space padding after the first field. (“□” shows a Space in output data). The blue arrows show the position of the cursor after each action.
Pad Data with Zeros to a Specified Length
This action can be used to direct the ADF Interpreter to pad each following send actions to a specified length by adding leading zeros. If the data to be sent is longer than the requested length, then no zeros are added. The blue arrows show the position of the cursor after each action.
For example, three fields of data are separated with dashes in the input data. This rule can replace the delimiter with fixed width fields with zero padding. The blue arrows show the position of the cursor after each action.
Stop Pad Zeros
The padding with zeros can stopped within a rule. Here is the previous example, stopping the zero padding after the first field. The blue arrows show the position of the cursor after each action.
Repeat Next Actin N Times
This feature allows for the quick sending of repeated data or keystrokes. This can be handy if you need to “TAB” past several fields in a windows form. The next Send action that follows the Repeat action will be repeated. This only applies to Send Keystroke or Send Value actions. The repeat only applies once and is cleared.
For example, if a barcode contains the customers name, but it is in the 4th field on the data entry form, then the sequence “Repeat 4 times, send TAB Key” could be added to facilitate data entry. (“→” shows a Tab in output data). The blue arrows show the position of the cursor after each action.
Filter Output Data
When processing data, sometimes the data has special characters or un-printable characters that are not needed. ADF has a filtering capability where one or more categories of ASCII data can be filtered out of the Output Data. (see Appendix: ASCII Type Classification for a list of ASCII values and their default character type). The blue arrows show the position of the cursor after each action.
ADF supports the filtering of these types of ASCII data:
- NON-PRINT - Non Printable ASCII value
- WHITESPACE - Tabs, Spaces, Line Feeds, Vertical Tabs, Carriage Returns
- NUMERIC - Values 0 to 9
- ALPHA - Values A to Z and a to z
- OTHER - ASCII values greater than 127
- SPECIAL - Everything else (for example: !@#$%^&*()_+)
- CUSTOM - Set of up to Custom Characters defined in the General Settings of the rule. See Chapter 4: Tips for Power Users of ADF for details on defining a custom character set.
An action can be added to a rule to “exclude” one or more ASCII categories from the output data. The following barcode contains a few samples from each ASCII type: (“□” shows a Space in output data)
Replace Non Printables
This feature allows the substitution of all non-printable characters in the scanned barcode data to be substituted with another ASCII value.
The example shows what would be transmitted if this feature is enabled with the period character “.” substituted. The blue arrows show the position of the cursor after each action.
Replace a Character with a Keystroke
This feature allows the substitution of a specific character with a Keystroke value. Zebra scanners support several categories of Keystrokes.
The following diagram shows the typical zones of a keyboard. Most keys that reside in these zones can be selected to replace the character specified in this action. Not all ALT or Command Shifted keys are supported for security reasons.
The following example shows how the comma delimiter can be replaced with the TAB key on the keyboard. (“→” shows a Tab in output data) The blue arrows show the position of the cursor after each action.
Tips for Power Users of ADF
The ADF interpreter provides a powerful rules based editor to process scanned barcode data and format the data before transmission to the attached host device. The previous chapters highlighted the most commonly used features of ADF, this section will provide information on ADF features that provide additional functionality when it is needed.
Individual ADF Rules can have Multiple Criteria Sections
The traditional ADF rule has a single Criteria section and an Action section, but what if you find that you have multiple rules with the same Action section. To avoid all that repetition, in the latest version of ADF, a rule can have up to four criteria sections. What this means is that four criteria sections all have the same actions.
Multiple criteria sections can be created in 123Scan by clicking on one of the four criteria section icons.
Clicking on the icon will allow the user to edit or add criteria to the section. The order of the sections is not important. Follow the prompts to select criteria in the editor. Once filled in, when the ADF Interpreter sees the criteria section it will check each one individually, if any of the sections evaluate to be “True” then the rule applies.
The following example shows a rule with three criteria sections. Each section has a few criteria and the sections have an OR relationship between them. All three share the same Action section. In this example, criteria section 2 applies. The blue arrows show the position of the cursor after each action.
How to Change the Status of a Rule Set
ADF has a mechanism to enable or disable one or more rules at a time using Rule Sets. It is described in Understanding Criteria within a Rule. There are eight numbered Rule Sets supported by ADF and each rule can optionally be assigned to a Rule Set number.
Rule Sets can be enabled or disabled using one of the following approaches:
- Use of a “Switching Rule” in ADF
- Use of a Special Barcode to manually turn Rule Sets on and off
- Use of scanner setting that ties Rule Set numbers to Host Interfaces
Use of Switching Rules
A rule could be added to ADF that checks for a certain User Defined barcode and if it is scanned, then an Action in the rule will enable or disable a specific Rule Set number.
This can be useful if the user wants to reconfigure the scanner differently depending on the scanner's use case. ADF Rules can be assigned to a Rule Set number assigned to each use case. And when the User Defined barcode is scanned, ADF can enable or disable the desired sets of rules and prepare the scanner for it's use.
Use of Special Rule Set Switching Barcode
ADF based scanners support pre-defined barcodes that can be used to manually enable or disable Rule Sets. Here are some samples. There is a full set of these barcodes covering all 8 Rule Sets downloadable online.
Use of Connected Host Interface
ADF can be configured to enable a particular Rule Set when a certain Host connection is made to the scanner. When the Host connection is changed to another type, the Rule Set can be disabled.
This can be useful if the scanner is used in two different locations in the business. Fox example, the Back Room will connect the scanner using an RS232 connection, and the Retail checkout lanes use a USB SNAPI connection. The scanner can be set to enable Rule Set 1 when RS232 is connected, and Rule Set 2 when USB SNAPI is connected.
ADF rules in the scanner related to the Back Room would be assigned to Rule Set 1 using a Criteria section entry, and ADF Rules for the Checkout would be assigned to Rule Set 2.
By doing this, the same scanner can be used and the scanner's ADF rules will adapt to its location of use.
How to Override ADF's Default Relationships Between Criteria
As shared earlier, ADF uses “Boolean Logic” to evaluate the Criteria section of a Rule. Most of the time, the default relationship between Criteria section items (AND/OR) works just fine. There are some rare cases, when a rule needs to use Boolean Operators to clarify the relationship between Criteria.
Care must be applied in adding Boolean Operators as it is possible to define a rule that will never apply. The ADF Interpreter does not do Semantic checking on the rule designs. For example, if you program a rule like this the rule will never apply:
If Length is 10 AND Length is 12
It is impossible for a barcode to have two different lengths.
Using an OR Relationship
Ordinarily two criteria of different types are related by AND:
If Criteria A is TRUE AND Criteria B is TRUE then the rule applies
However, there might be an occasion when either of these Criteria should cause the Rule to apply.
If Criteria A is TRUE OR Criteria B is TRUE then the rule applies
To program a Rule this way, the OR operator needs to be inserted in the Rule. For Example, the Rule Entry in 123Scan could be setup like this:
This would override the default “AND” relation between the two criteria. Both the “AND” and “OR” operators are only allowed to be inserted between two criteria.
Using a NOT Relationship
ADF provides the ability to Negate a Criteria entry. For example, a rule can have the following:
If NOT Code 128 then the rule applies
The NOT Boolean operator negates the criteria, so in this case, any Code type but Code 128 evaluates to TRUE.
The NOT Operator can also be combined with AND and OR:
If Code 128 AND NOT length 12
If Starts with “A” OR NOT Code 128
The NOT operator is only allowed to be inserted at the front of the Criteria list, or following the OR or AND operators.
How to Display non-Printable Characters in Your Barcodes
ADF has an action called “Replace Non-Printable” that substitutes all non-printable characters with a single ASCII character, such as a period “.”. But what if you want to see what the specific non-printable characters are in the barcodes that you scan.
ADF supports a special case where non-printable characters can be converted to a “hexadecimal escape sequence”. This feature allows each non-printable character in the input data to be displayed in the format \x99, where 99 is substituted with the non-printable character's value in hexadecimal. (see glossary for info on Hexadecimal numbers)
To use this, the “Replace Non-Printable” action is performed with a replacement value of 255.
The example shows what would be transmitted if this feature is enabled. The blue arrows show the position of the cursor after each action.
How to Define a Custom Character Set to Support Data Filtering
ADF has a powerful filtering feature that can screen through barcode data to eliminate it, or to match barcodes that have it. A rule can have a Custom Set of characters defined to be referenced within the rule. The General Settings section of the rule has a place to setup this list. Up to 16 characters can be selected.
Adding a character to the Custom set overrides the default type of a character. (see Appendix: ASCII Type Classification for a list of ASCII values and their default character type).
For example, at the checkout stand, barcodes that contain a slash character “/” or a Dollar sign “$” need special parsing to remove price and quantity data. The characters “/” and “$” can be put in the Custom character set. In the “Barcode Content” criteria the “Custom” Character set can be selected. Then whatever needed parsing rules can be setup in the Action Section.
Failure Recovery
Updates to the ADF Interpreter
Advanced Data Formatting has been in Zebra's products for many years, and the latest version of the ADF interpreter is able to support all of the legacy features and rule formats. There are some basic limitations that need to be noted depending on the selected Rule Format.
Limitations of Using the Legacy ADF1 Format
If the stored ADF rules are in the ADF1 Format, then only rules in that format may be added. For scanners with the latest ADF, any ADF opcode both new and old may be used, except those related to “General Settings”:
- Only 1 criteria section is allowed
- Pattern Match and Replacement strings are limited to 10 characters
- Changing the input source to User Defined String, or Asset Information is only allowed to process up to 30 characters. Any data that exceeds this length are truncated to 30 characters.
- No use of the Custom Character set
Using the legacy ADF1 Format will use less Flash space per rule and it will allow for the storage of more rules. Though the size of the overall rule buffer is sufficiently large enough for most user’s needs.
Benefits of Using the Latest ADF2 Format
If the stored ADF rules are in the ADF2 Format, then only rules in that format may be added. Any opcode both new and old may be used without limitation. This is the default format supported with the latest version of ADF.
The General Settings section of the ADF Rule has some settings that customizes how the rule is built and executed.
Understanding Action Failures
A key aspect of understanding ADF editing is knowing that “ADF Rules require that the data matches the rule”. Actions in the rule can move the cursor forward or backward a specified number of positions, or until a matching character or pattern is seen. If an action requests to move to a place in the data that does not exist, then the rule is said to have an “Action Failure”.
In the legacy ADF1, an Action Failure would cause the rule to Exit and the ADF Interpreter would try the next rule.
In ADF2, each rule can be configured to recover from an Action Failure in one of three ways:
- Exit Action (default)
- Ignore Action
- Partial Action
The General Settings section of each rule can choose one of these responses to an Action Failure. For more details on what happens with specific actions, refer to Appendix: Action Failures and Recovery. If the Action Fail Recovery feature is not selected the rule will exit on an action failure as in ADF1.
Sample Rule Set
For this section, all the examples refer to this sample set of rules:
| Rules | Criteria | Actions |
|---|---|---|
| Rule 1 | When barcode starts with “A” |
Skip ahead 5 characters Send data up to “.” Send <@> character Send all data that remains Send <Enter> Key |
| Rule 2 | When barcode starts with “A” |
Skip ahead to “-” Send all data that remains Send <Enter> Key |
| Rule 3 | When any barcode is scanned |
Send next 5 characters Send <Enter> Key |
| Rule 4 | When any barcode is scanned |
Send “???” Send <Enter> Key |
Exit Rule on Action Failure
Traditionally, on an Action Failure, ADF will exit the failed rule and resume looking for the next rule that applies. This can be used to select rules with even more granularity than the criteria section.
For example: If the rule buffer contains the sample set of rules in the previous section, then the ADF Interpreter will run them as follows. The left column shows what barcode is scanned, and the remaining columns show what rules applied due to the “Exit Rule” recovery process.
| Input Data Scanned | Rule Applied | Output Data | Reason |
|---|---|---|---|
| A12345XYZ.879 | Rule 1 | 5XYZ@879 <Enter> | All actions passed |
| A12345XYZ-879 | Rule 2 | 879 <Enter> | Rule 1 Action Failed (no “.”) |
| A12345XYZ879 | Rule 3 | A1234 <Enter> | Rule 1 and 2 Action Failed (no “.” Or “-“) |
| A123 | Rule 4 | ??? <Enter> | Rule 1 and 2 Action Failed (no “.” Or “-“) Rule 3 Action Failed (only 4 characters to send) |
Ignore Actions That Fail
The latest version of ADF allows the ADF Interpreter to be configured to ignore any action that fails. This means that the rules with Action Failures will not exit but continue.
Using the sample set of rules from the previous section, this table shows how the ADF Interpreter will respond to the rules with “Ignore Action Failure” enabled:
| Input Data Scanned | Rule Applied | Output Data | Reason |
|---|---|---|---|
| A12345XYZ.879 | Rule 1 | 5XYZ @879<Enter> | All actions passed |
| A12345XYZ-879 | Rule 1 | @5XYZ-879 <Enter> | Send data up to “.” ignored |
| A12345XYZ879 | Rule 1 | @5XYZ879 <Enter> | Send data up to “.” ignored |
| A123 | Rule 1 | @A123<Enter> | Skip ahead 5 characters ignored Send data up to “.” ignored |
Partial Action Applied When an Action Fails
The latest version of ADF also allows the ADF Interpreter to be configured to do what it can when any action that fails. This means that the rules with Action Failures will not exit but continue. For more details on what happens with specific actions, refer to Appendix: Action Failures and Recovery.
Using the sample set of rules from the previous section, this table shows how the ADF Interpreter will respond to the rules with “Do what it can” enabled:
| Input Data Scanned | Rule Applied | Output Data | Reason |
|---|---|---|---|
| A12345XYZ.879 | Rule 1 | 5XYZ @879<Enter> | All actions passed |
| A12345XYZ-879 | Rule 1 | @5XYZ-879 <Enter> | Send data up to “.” ignored |
| A12345XYZ879 | Rule 1 | @5XYZ879 <Enter> | Send data up to “.” ignored |
| A123 | Rule 1 | @<Enter> | Skip ahead 4 characters instead of 5 |
123Scan Utility
Advanced Data Formatting Programmer's Guide