AutoStore: Smart RRT

If Runtime Replacement Tags (RRTs) make an AutoStore configuration come to life, then workflows can get a bit more clever when Smart RRT technology is used. The Smart RRT is not a new gadget, but these little wonders can come in handy.


What is a Smart RRT?

As a placeholder for information, an AutoStore RRT has an RRV, which stands for Runtime Replacement Value. We can take a user-defined RRT, also referred to as a FRTN (Field Replacement Tag Name), and inject VBScript into the RRT to quickly modify that tag's value.

The result is a Smart RRT.

A Smart RRT is certainly not the only way to modify the value of an RRT. The VB/JScript component allows a custom script to be used to generate a needed value based on a metadata value, and the Data Filter component also provides several filters to do the same.

There are cases where implementing a Smart RRT may generally be a quicker approach if a given workflow can benefit from the RRV of its modified RRT. We'll look at some examples, but let's first examine how to create a Smart RRT using the following sample RRT.

~RRT::%Sample%~

Within the tag itself, there is an ending tilde (~) that closes the RRT. Just to the right side of the closing tilde, manually place special start and end markers.

~RRT::%Sample%<?></?>~

Inside of these markers is where the VBScript code can be added. The following is a very basic example, and from this point on, some familiarity with VBScript will be needed.

~RRT::%Sample%<?>RRV=RRV</?>~

Inside of those special markers, the value of the tag can be obtained or assigned be declaring RRV. Notice the VBScript statement where we use the equals sign (=) to assign the value of the RRV right back to the value of the RRV itself.

RRV=RRV

In other words, this is like indicating that value should be the same as itself. So, in this case, the output value of the RRT alone and that of the Smart RRT end up being identical.

OK, despite the fact that this example is not very useful from a practical sense, it does explain the basic construct of the Smart RRT, and illustrates how tap into the tag's actual value, which is the RRV. Now, to build on top of this, a more useful example would be needed.


Example - Get The First Character

Imagine a scenario where an organization has a shared drive that has a folder in it named "Vendors" which is used to store various documents. Within it are a series of folders named by company name for a specific vendor. This practice is both common and logical.

Shared Drive
Vendors
ACME

Over time, as the number of vendors grows from hundreds to the thousands, it can be a time-consuming process for Windows Explorer to display through and display that many objects. Placing vendor folders inside of an alphabetical index folder can be speed things up.

Shared Drive
Vendors
A
ACME

Because that index folder is named by the first character of the vendor name, if an AutoStore configuration was defined to capture the Vendor name and route to a folder, the Send to Folder component needs to be configured to determine the correct path for a vendor.

Whether the name of the company is "ACME" or "Best Corp", we need to figure out what the left-most character of the Vendor name is so that the index folder is dynamically assigned to the destination folder path.

Using a little VBScript to get the first character of the Vendor name can help. VBScript's Left() function returns a specified number of characters from the left side of a string.

Left(string, length)

The following statements describe some different output examples of the Left() function:

RRV = "ACME"
RRV = Left(RRV, 1)
'the output RRV is "A"

RRV = "Best Company"
RRV = Left(RRV, 1)
'the output RRV is "B"

RRV = "ACME"
RRV = Left(RRV, 2)
'the output RRV is "AC"

RRV = "Best Company"
RRV = Left(RRV, 2)
'the output RRV is "Be" 

The following example shows how we can incorporate that Left() function into the RRT to make it a Smart RRT.

~RRT::%Vendor%<?>RRV=Left(RRV,1)</?>~

The missing piece can now be combined with the regular RRT to form the Send to Folder path.

Example:

~RRT::%Vendor%<?>RRV=Left(RRV,1)</?>~\~RRT::%Vendor%~

With "ACME" as the RRV, the following would be that result:

A\ACME

Now, the destination folder path is dynamic, and it really didn't take that much more for us to get there. Before arriving at the necessary VBScript, understanding the basic requirement to determine what code was needed was the key.


Example - Find a Key Word

In the next example, we are looking for the word "INV" in the detected text found within an OCR zone. If it is found, a Smart RRT should be used to dynamically route the document into an "Invoice" folder, and if "INV" is not present, it should go into a folder named "Non-Invoice".

Example:

~FRO::%OcrZone%.1<?>If InStr(1,RRV,"INV",1)>0 Then\n RRV="Invoice"\n Else\n RRV="Non-Invoice"\n End If</?>~

Just like an RRT, a Smart RRT is placed into a configuration field as a single line. As such, the code inside the Smart RRT must be a contiguous single line of code. In situations where the necessary VBScript is more than one line, then the new line can be added using the \n character set.

If-Then statements in VBScript need to be on separate lines in order to compile. This example shows the "\" escape character before the "n" character to indicate the placement where the new lines would normally be positioned.


Why use a Smart RRT?

Like a builder with a comprehensive toolkit, the Smart RRT would be one of those tools. Depending on the need, using a Smart RRT is not always the best choice. In my experience, I have found two instances where using a Smart RRT has been valuable.

  • Basic string manipulation
  • When tiny logic is needed


When planning a workflow process, the general approach should begin with all of the actual requirements. If there are a several instances where the amount of VBScript needed to get the task done is lengthy, then the VB/JScript component may be the best choice.

That's not to say that different technologies cannot be blended within a single AutoStore configuration, but it can look a little confusing as the CFG grows over time when trying to determine where any possible changes need to be made in the future.


In Closing

Using a Smart RRT with a user-defined RRT has worked well, such as input fields on a multifunction device, or a barcode field. With the values of RRTNs (Reserved Replacement Tag Name), for example the file extension RRT of the Send to Folder component, because these tags are reserved, these RRV values behave as read-only.

Smart RRTs can be used nicely in configurations for testing, demonstration, or production. When the length of a Smart RRT becomes too long, or too many of them are sprinkled through the CFG, it may be time to consider using an actual script so things are less confusing.

Finally, always test, test always.

Comments

Popular posts from this blog

VBScript: Ensure Backslash Folder Path

AutoStore: Create a Custom RRT

AutoStore: Workflow Loop Example