You are here: Function Reference > Alphabetical Listing > L > ListInList

ListInList

Use this function to search for the comma-delimited list specified by the second parameter for each character string in the comma-delimited list specified by the first parameter. If a match is found, the function returns the ordinal position (integer) of the first string in the second parameter that matches any of the strings in the first parameter. If no match is found, the function returns a zero (0).

Syntax

ListInList (StringList, ListString)

Parameter

Description

StringList

Enter the name of the list of character strings or enter the list of character strings you want to search for. Use commas to separate each character string entry you want to find. Keep in mind the system considers spaces when searching, so strings must match exactly.

ListString

Enter the name of the string list or the character string list to be searched. 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).

Example

Here is an example:

This function statement

Returns

Assuming

ListInList( @("e_codes"), "ABC,AB,DE,A,GFHI,ABCD" )

 

Field e_codes contains: ABC,A.

ListInList( GetValue("e_codes"), "ABC,AB,DE,A,GFHI" )

2

DAL variable, e_codes, contains: AB,abcd.

ListInList( ?("e_codes"), "ABC,AB,DE,A,GFHI,ABCD" )

3

XDB entry e_codes returns: DE,a.

ListInList( ?("e_codes"), ?("t_codes") )

4

XDB entry e_codes returns A. The entry t_codes contains: ABC,AB,DE,A,GFHI,ABCD.

ListInList( ?("e_codes"), "ABC,AB,DE,A,GFHI,ABCD" )

0

XDB entry e_codes returns: XYZ.

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. For this example assume the following parameters contain:

This statement

Returns

#rc = ListInList( GetValue(col_name1), col_name1_codes )

3

#rc = ListInList( GetValue(col_name1), GetValue(col_name1_codes))

4

The return value for the above example returns a four (4) because two spaces exist between the comma and EE.

Keep in mind:

ListInList("Steel,Wood", " Steel,Aluminum")

ListInList("Steel,Wood", "Steel ,Aluminum")

ListInList("Steel,Wood", "Aluminum,Steel ")

See also