Transformation Language Reference > Functions > INDEXOF
  

INDEXOF

Finds the index of a value among a list of values. By default, the match is case sensitive.

Syntax

INDEXOF( valueToSearch, string1 [, string2, ..., stringN,] [CaseFlag] )
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
valueToSearch
Required
String datatype. Value you want to search for in the list of strings.
string
Required
String datatype. Comma-separated list of values you want to search against. Values can be in string format. There is no maximum number of values you can list. The value is case sensitive, unless you set CaseFlag to 0.
CaseFlag
Optional
Must be an integer. Specify a value when the valueToSearch argument is a string value. Determines whether the arguments in this function are case sensitive. You can enter any valid transformation expression.
When CaseFlag is a number other than 0, the function is case sensitive.
When CaseFlag is 0, the function is not case sensitive.

Return Value

1 if the input value matches string1, 2 if the input value matches string2, and so on.
0 if the input value is not found.
NULL if the input is a null value.

Example

The following expression determines if values from the ITEM_NAME port match the first, second, or third string:
INDEXOF( ITEM_NAME, ‘diving hood’, ‘flashlight’, ‘safety knife’)
ITEM_NAME
RETURN VALUE
Safety Knife
0
diving hood
1
Compass
0
safety knife
3
flashlight
2
Safety Knife returns a value of 0 because it does not match the case of the input value.