VBScript is the programming language that allows you to define expressions for the SearchExpression, SearchByDistance, SearchShape methods, Expression and LabelExpression properties. Documentation for VBScript is available from the following address: http://msdn.microsoft.com/scripting.
In addition to standard VBScript functions, the following functions are supported:
IIF Function
Returns one of two parts, depending on the evaluation of an expression.
IIF(expr, truepart, falsepart)
Parameters:
expr
Expression you want to evaluate.
truepart
Value or expression returned if expr is True.
falsepart
Value or expression returned if expr is False.
Example
Map1("roads").LabelExpression = "IIF(ROAD_CODE = ""A41"", ROAD_CODE, """")"
LIKE Function
Determines if a character expression matches a pattern.
LIKE(expr, pattern)
Parameters:
expr
Specifies the character expression LIKE( ) compares with pattern. expr must match pattern letter for letter in order for LIKE( ) to return True.
pattern
Specifies the pattern that LIKE( ) compares with expr. pattern can contain the wildcards such as * and ?. The question mark (?) matches any single character in expr and the asterisk (*) matches any number of characters.
Example
recordset = Map1("streets").SearchExpression("LIKE(STREET_NAME, ""Main*"")")
PCASE Function
The PCase function returns a string in proper case..
PCASE(string)
Parameters:
string
Specifies a string.
Example
Layer.LabelExpression = "PCASE(
STATE_NAME )"
state = PCASE( "neW york" )
Output: "New York"