The SEARCH function examines a source data string and compares it against a second search data string. If the search data string is found within the source data string, Connect CDC (SQData) returns the starting position of the matching characters within the source data string. If no match is found, a value of zero (0) is returned.
Category
String
Syntax
SEARCH(data_string, search_data_string)
Parameter | Description |
---|---|
data_string | The data string in character format. This data string can be a field from a source datastore, a variable, a constant or the result of another Function. |
search_data_string | One (1) or more characters that will be used as the search criteria to examine the data string for a match. Search data strings may be a field/column of a datastore, a literal value or the output of another Function. |
Example 1
Find the position of the value TAN within a source field INPUT_STRING. Assume that the field INPUT_STRING contains the value MUSTANG. Map the result to target field STRING_POS.
STRING_POS = SEARCH (INPUT_STRING, 'TAN')
Returns the value 4 and maps the result to the target field.
Example 2
Search a literal for the value RED and return the position in which the match first occurs. Map the result to target field STRING_POS.
STRING_POS = SEARCH ('READY', 'RED')
Returns the value 0, since there source data string did not contain the value 'RED'.