Use this function to search for a string in a list of a strings.
Parameter |
Description |
String |
Enter the string you want to search for. Keep in mind the system considers spaces when matching strings and that the strings must match exactly. |
List |
Enter the name of the list of strings. Use commas to separate each string entry you want to search for. |
The function returns a number that indicates which string entry was found. For instance, if the third string entry was found, the function returns a three (3).
Here is an example:
CodeInList( "ABC", "ABC,AB,DE,A,GFHI,ABCD" )returns 1
CodeInList( "AB", "ABC,AB,DE,A,GFHI,ABCD" )returns 2
CodeInList( "DE", "ABC,AB,DE,A,GFHI,ABCD" )returns 3
CodeInList( "A", "ABC,AB,DE,A,GFHI,ABCD" )returns 4
CodeInList( "GFHI", "ABC,AB,DE,A,GFHI,ABCD" )returns 5
CodeInList( "ABCD", "ABC,AB,DE,A,GFHI,ABCD" )returns 6
CodeInList( "XYZ", "ABC,AB,DE,A,GFHI,ABCD" )returns 0
CodeInList( "", "ABC,AB,DE,A,GFHI,ABCD" )returns 0
CodeInList( "ABC", "" ) returns 0
CodeInList( "", "" ) returns 1
If you omit the first parameter, you get the data from the current field. If you omit the second parameter, you receive this error message:
Wrong number of parameters
Here is another example:
Assume that GetValue(col_name1) results in the string: EE. And the variable col_name1_codes contains the string: EEacb,XXEE,EE,AEEAC.
#rc = CodeInList( GetValue(col_name1), col_name1_codes ) returns 3
Keep in mind...
CodeInList("Steel", " Steel,Aluminum")
CodeInList("Steel", "Steel ,Aluminum")
CodeInList("Steel", "Aluminum,Steel ")
and will return zero (0) each time.
© Copyright 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices