Look Up looks up a key, usually expressed with a macro, against a text file that is filled with one column of keys and up to five columns of values.
For example, given a file name of "report56.txt" (in the Lookup_Key parameter) and the path to a file containing the following keys and values (in the Lookup_FilePath parameter), the Look Up built-in script returns a value of "customer13.rpt" (in the Lookup_Value parameter). To obtain this Lookup_Value, the Look Up built-in script compares Lookup_Key to the "file keys" and returns the related value from the first matching line.
report44.txt,customer01.ttk
report56.txt,customer13.rpt
report66.txt,customer87.lml
Input Parameters
,
). For example, if a single line of keys and values is "753|blue|large", set this parameter to a vertical bar (|
).'
). For example, if a single line of comment is "# This is a comment", set this parameter to a pound (hash) sign (#
).LookUp_Key "dog.txt" matches file key "dog.txt", but does not match the file key "do".
LookUp_Key "do" does not match file key "dog.txt".
Example: A LookUp_Key of "dog.txt" or "dog" matches file key "dog.txt", but does not match the file key "do".
Example: LookUp_Key "dog" matches file key "do", but not file key "dog.txt".
Example: If LookUp_ReturnAs="AltFolder" and LookUp_Value="\another\fol", then the macro "[Parm:AltFolder]" is interpreted as "\another\fol" during the rest of the task run.
Wildcards
Lookup keys can contain wildcards, except when "Require_Exact_Match" is in effect. The wildcard syntax is similar to Windows filename masks, with some enhancements:
Wildcard char |
Meaning |
---|---|
* |
Match zero or more of any character. |
? |
Match exactly one of any character. |
@ |
Match exactly one alphabetic character. |
# |
Match exactly one digit. |
anything else |
Match exactly that character. |
Examples:
dog# |
Matches "dog3". Does not match "dog" or "dogs3" |
dog*7 |
Matches "dog7", "dog37" and ")dog/7PP". Does not match "dog" or "do7". |
Output Parameters
Notes
In most production cases, you will probably use macros such as "[OrigName]", "[OnlyName]", "[RelativePath]" or "[MID([OrigName], 2, 3)]" in your "LookUp_Key" parameter.
This built-in script can be run wherever processes are allowed, including alone in its own task.
Example #1
Fred wants to look up a specific internal folder based on the username that uploaded a file. If a record for a particular username cannot be found, log an error.
To perform this operation with MOVEit Automation:
' Format is username,folder
jack,D:\blue\2134
diane,D:\red\3734
american,D:\blue\3357
kids,D:\red\1651
heartland,D:\red\2162
Given the contents of "fred.txt" shown above, the following uploader usernames causes the following values to be placed into the LookUp_Value parameter.
Uploader Username |
LookUp_Value |
diane |
D:\red\3734 |
heartland |
D:\red\2162 |
congress |
(NONE - ERROR) |
Example #2
Nancy wants to change the names that several of her files are saved as, but many file names already have the correct names.
To perform this operation with MOVEit Automation:
' Format is incoming filename, corrected filename
JHJ45KK,nice_J45.dat
JTE_KTR_67,nice_K67.dat
K_P0KX_R89,nice_L89.dat
Given the contents of "nancy.txt" displayed above, the following filenames cause the following values to be placed into the LookUp_Value parameter.
Source File Name |
LookUp_Value |
JHJ45KK |
nice_J45.dat |
hello.txt |
hello.txt |
K_POKX_R89 |
nice_L89.dat |
K_pokx_R89 |
K_pokx_R89 |
Example #3
Ed wants to set FTP mainframe parameters based on the names of files MOVEit Automation has just downloaded. He wants to be able to handle both specific filenames (for example, "four.txt"), general extension (for example ".txt") and provide a "catch-all" value.
To perform this operation with MOVEit Automation:
' List specific filenames first
four.txt,80,4
' Next, list specific extensions
.txt,80,10
.dat,133,5
' Finally, provide a catch-all case
' (this assumes all incoming filenames will contain a period)
.,80,10
Given the contents of "ed.txt" displayed above, the following source file names cause the following values to be placed into the LookUp_Value and LookUp_Value2 parameters.
Source File Name |
LookUp_Value |
LookUp_Value2 |
four.txt |
80 |
4 |
five.txt |
80 |
10 |
six.dat |
133 |
5 |
seven.rpt |
80 |
10 |
Example #4
Ralph wants to scan an entire folder structure and transfer only the files that match names in his lookup table file. Files that do match should usually be renamed.
To perform this operation with MOVEit Automation:
' List specific filenames first
ur.txt,rrr[OnlyName].xtx
' Next, list specific extensions
.txt,[OrigName]
.dat,[OnlyName].tad
Given the contents of "ralph.txt" displayed above, the following source file names cause the following files to appear on the destination with the following names.
Source File Name |
Destination File Name |
four.txt |
rrrfour.xtx |
five.txt |
five.txt |
six.dat |
six.tad |
seven.rpt |
(file ignored) |