# SEARCH CALCULATIONS

Functions for Calculations for custom searches:

String means a group of letters/numbers.

Mid(String, Position, Length)
Returns a substring of a specified length, starting at a specified position, from a larger string. If position is less than 1 it is taken as 1, that is the first character; if it is greater than the length of the string, an empty string is returned. If length is greater than maximum length of any string or substring of string starting at position, then the returned substring will be the remainder of string starting at position.
Examples:
mid(‘Information’,6,3) = ‘mat’
If your Stock Number is 100-R, then mid(IVNUM,2,2) = 00

Pos(Substring, String)
Returns the position of a substring within a larger string. The substring must be contained within string in it’s entirety for the returned value to be non-zero.
Examples:
pos(‘Mouse’,’Mickey Mouse’) = 8
If your Stock Number is 100-R, then pos(’00’,IVNUM) = 2

Does Not Contain:
Example, Stock Number does not contain a Z
pos(‘Z’,IVNUM) = 0

Len(String)
Returns the length of a string, that is, number of characters.
Examples:
len(‘Hello’) = 5
If your Stock Number is 100-R, then len(IVNUM) = 5

Upp(String)
Returns the uppercase representation of a string. Any non-alphabetic characters in the string are ignored.
Examples:
upp(‘Author’) = ‘AUTHOR’
If your Customer Name is Smith, then upp(CNAME) = SMITH

Revised 11-9-16, AG