Download
What does this application do?
Warehouse Sorting sample application demonstrates the use of a NetLogix C# Script to sort packages to their required destination based on a barcode destination label on the box. The script uses a Regex (Regular Expression) pattern to search, match, validate, or manipulate text strings. The app receives three codes once the box goes through a barcode scanning tunnel. It identifies the code that matches a pattern from a database and returns the matching route. The database can be modified by the user to add or edit patterns and routes. There's also a log that stores the matched codes and their corresponding route.
Is this application relevant to me?
Quickly sort packages to the correct destination chute using FactoryTalk Optix’s NetLogix C# scripting and Regex.
Success stories:
- Warehouse package distribution center for faster delivery service.
- 360° scanning tunnels can be implemented by adding more scanners.
Advantages:
- Identify patterns in data strings using Regex.
- Shows the use of methods of C# scripts using Netlogic.
- Shows the use of database methods included in the datastore object.
- Shows the use of the data logger object.
Limitations: This is a simulation file, for full applications test a PLC and Barcode Scanner is needed and properly configured. (not covered in this sample)
Please note: You will need to agree to the Terms & Conditions for each download.
Need Help?
If you need help with an application or have feedback from the Innovation Center, please contact us.
How can I make it work?Requirements: products, tools, prior knowledge.
Hardware:
- FT Optix Ready Device
- Optix Panel
- Optix Edge
- Embedded Edge Compute
- ASEM Industrial PC
(if testing with hardware, minimum one is needed)
Software:
- FactoryTalk Optix Studio
- FactoryTalk Optix Runtime Emulator
- FactoryTalk Optix Runtime
- If running application on an ASEM industrial computer (or 3rd party computer)
Previous Knowledge
- Basic understanding of FactoryTalk Optix.
- Optional: Knowledge of how Regex expressions work is needed to generate other Regex expressions.
Implementation Guide
This demo is self-contained; it doesn't rely on any other information source other than FT Optix.
- Step 1
- Step 2
- Step 3
- Step 4
- Step 5
- Step 6
Download the project file and open the application using FactoryTalk Optix Studio.
This application was developed using version 1.7.0.804.
Make sure that the embedded Emulator is selected as the active deployment target:
warehouse-sorting-with-optix_Picture1.png
Click the Run on Emulator “play”⯈ symbol to start the emulator.
In the Regex Config tab, you will see an empty table. To populate the table with your 1st destination data, fill in all text boxes in the “Add to Table” section in the right side of the application screen with the Regex Expressions to compare.
See some Regex suggestions in Table No.1:
| Destination |
Regex Pattern Format |
Regex Expression |
Route |
|---|---|---|---|
| 1 | AB-####-@@ |
^AB-\d{4}-[A-Za-z]{2}$ |
North |
| 2 | Rock###### |
^Rock\d{6}$ |
South |
| 3 | ##-ASEM01 |
^\d{2}-ASEM01$ |
East |
| 4 | 9324-####ENE |
^9324-\d{4}ENE$ |
West |
| 5 | ##-Optix-## |
^\d{2}-Optix-\d{2}$ |
North |
Table No. 1 - suggestions
For each desired destination, fill in the fields and click the “Add to table” button.
Example:
warehouse-sorting-with-optix_Picture2.png
warehouse-sorting-with-optix_Picture3.png
There are several Regex sources online that explain how to build Regex Expressions.
Here’s a brief explanation of the expression of Destination 1: ^AB-\d{4}-[A-Za-z]{2}$
^ |
Start of the string |
AB- |
Starts with “AB-” |
\d{4} |
Four numerical digits |
-[A-Za-z]{2} |
Two alphabetic digits |
$ |
End of string |
To simulate a trigger operation, manually input each of the 3 text input fields next to each barcode reader in the image below.
Then press the “Trigger” button.
Example:
warehouse-sorting-with-optix_Picture7.png
From this result example we can see that out of the three codes “scanned”, only the one marked by the green outline is valid and that the Matched Route is North. The information on your screen may vary depending on the information provided.
The “Trigger” button executes a NetLogic C# script that uses Regex to compare each “Scanned Number” with each of the Regex expressions of the table, once a match is found, it returns the corresponding Route, if none is found, then a “Not Found” is returned.
As stated previously, this application is not intended to be used in a production environment; this script only has the necessary code to show the functionality of the Regex + NetLogic script within a FactoryTalk Optix application.
To test this application feeding this information automatically from a device such as a PLC, link these variables to the tag with the scanned codes:
warehouse-sorting-with-optix_Picture8.png
The script is executed with the method “RegexCompare”, it must be triggered by your preferred way, an option is a change of value of a tag from the PLC.
warehouse-sorting-with-optix_Picture9.png
Warehouse Sorting with Optix
Version 1.0 - August 2026