Copyright © 2007 • MCL Technologies • All Rights Reserved
www.mcl-collection.com
Chapter 5 : Using Processes
5.8.6. Variable Position
General introduction The Variable Position process allows you to search for and determine
the position of a specific character or string of characters inside a
variable.
The process gives the position of the first character of the string inside
the variable, and the position of the first character after the end of the
string.
Variable Position To search for and determine the position of a character(s) inside a
variable, proceed as follows:
1 Add the process Variable Position to your label program
2 Select the input variable
3 Enter the character or string of characters to search for. This can
also be a variable if the search criteria is contained in a variable
4 Select the occurrence of the criteria:
First occurrence in the input variable after the “From Position”,
Last occurrence in the input variable before the “To Position”,
5 Specific occurrence between the “From Position” and “To
Positions”
6 Enter values for the From Position and To Position. These
entries define the area inside the input variable where the search
must start and stop. A zero for the “To Position” means until the
end of the variable in the case where a variable varies in length.
7 Click beside the Result Variable box.
8 Select or create the variable to receive the position of the first
character of the contents for which you are searching and click
OK.
9 Click beside the Result Var [End+1] box.
10 Select or create a new variable to receive the position+1 of the
last character of the contents for which you are searching and
click OK.
11 Click OK
Examples In this example, the variable [C1] is searched for a match for the word
“check”. When it is found for the first time, its starting position in
variable [C1] is saved in variable [C2]. The ending position +1 of the
first occurrence of “check” is saved in variable [C3].
October 2007 Page
168