Look up options for operating with text
A text manipulation formula can be entered into the Look-up table by using an '=' symbol as the first character in the value field. If there is no '=' symbol the text is treated as a constant and is not evaluated.
A text manipulation formula can be:-
Look-up references
Variables
Text functions
Integer numbers
By specifying a look-up name within the value field of another look-up you can nest lookups (up to a maximum of 10 deep).
References to variable names must be surrounded by the '@' symbol.
The following text functions are available:
LEFT(input, number)
RIGHT(input, number)
MID(input, number [, number])
input + input
LEN(input)
CELL (table,row,column)
INSTR (target text,search text)
RINSTR (target text, search text)
REPLACE (initial text, search text, replace text)
TOUPPER (text)
TOLOWER (text)
The function names can be specified in upper or lower case.
LEFT (input, number) - This function extracts a specified amount of characters from the left-hand side of 'input'.
e.g. LEFT (@MATNAME@, 4) will take the first 4 characters of whatever the answer to the variable @MATNAME@ is. RIGHT (input, number)- This function extracts a specified amount of characters from the right-hand side of 'input'.
MID (input, number [,number]) - This function extracts characters from a specified position in the 'input'. An optional parameter specifies how many characters are extracted.
e.g. MID ("PARTCODE", 5) will take the characters from the 5th position of 'input' to the end which is "CODE" MID ("PARTCODE", 5, 2) will take 2 characters from the 5th position which is "CO"
input1 + input2. The '+' symbol is used to combine two inputs together. e.g. a lookup of ="FUNC"+"TION" gives a result of "FUNCTION"
F2 - A larger dialog can be displayed to show a full lookup value by pressing the F2 button when in the value field or pressing the button at the right hand side of the grid. This dialog also provides buttons to insert lookup names and variable names into the lookup text.
INSTR
Use this function to locate the position of text in longer string of text.
INSTR (target text, search text)
For example to locate "/" within the text "MEL/18/CHIP"
INSTR("MEL/18/CHIP","/")
The function, in this example, returns a value of '4'
If the text is not found the function returns a value of 0.
RINSTR
Use this function to locate the position of the last occurrence of a character in a string. This can be useful where the information required is at the end of a piece of text, for example, a file name at the end of a long text which also contains the path name (e.g. c:\user1\part data\2015\job36.ptn)
For example, locate the last occurrence of "/" in "MEL/18/CHIP"
RINSTR("MEL/18/CHIP","/")
This looks for the position of the last occurrence of "/" within "MEL/18/CHIP" and the result is '7'
If the text cannot be found the result is zero.
REPLACE
Inside a string formulae, the function REPLACE can be used to replace character(s) with other character(s).
The format of the function REPLACE is as follows:
REPLACE (initial string, search string, replace string)
e.g. REPLACE (LAM-OAK,LAM,LAMINATE) would give the following LAMINATE-OAK.
If the search string is not found, then the text will be unchanged.
TOUPPER
This function is used to convert the text inside the brackets into upper case characters.
TOUPPER(BaseDoor)
would return
BASEDOOR
To set the product description information box to all upper case, the following would be specified in the cutting list rules:
Field Value
Product description =STR(TOUPPER([Product description]))
TOLOWER
This function is used to convert the text inside the brackets into upper case characters.
TOLOWER(MELCHIP18MM)
would return
melchip18mm
To use a mixture of upper and lower case
=TOUPPER(BaseDoor)+TOLOWER(MELCHIP18MM)
would return
BASEDOORmelchip18mm
Notes
Validation - If an invalid lookup formula is entered into the lookup table, an error message will be displayed, the result of lookup will be a blank string. The error message will also be displayed if a invalid lookup is used in a text field in the part library or product library.
Errors can occur for one of the following situations:
- incorrect number of brackets in the lookup
- incorrect number of arguments for a text function
- wrong field type for a function argument (e.g. a number where there should be text)
Text manipulation formula can only be entered in the Look-up table. Numeric formula can entered in the formula table and also in most fields that allow numeric fields.
If a variable in a formula does not exist an error is reported. If the variable does exist but does not have an answer the value is set to blank.