Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

ListFindFirst

Use this function to search a list for the first occurrence of a specified value and return the index of the match.

Syntax:

ListFindFirst(list, find)

where:

  • list is a variable of type NUM[], STRING[], or RANGE.
  • find is the value to search for or a variable of the same type as list that contains the values to search for in list. If you are searching for a string value, you must enclose it in double quotation marks.

Syntax example:

CREATE VARIABLE myList1[] AS STRING

CREATE VARIABLE nResult AS NUM

CREATE VARIABLE bResult AS NUM

CREATE VARIABLE sValue AS STRING

 

SET VARIABLE myList1 = "a|b|c|d|e|f"

SET VARIABLE sValue = "d"

SET VARIABLE nResult = ListFindFirst(myList1, sValue)

SET VARIABLE bResult = ListFindFirst(myList1, "b")

 

// In this example, nResult equals 4 and bResult equals 2.

Published:

ListFindFirst

Use this function to search a list for the first occurrence of a specified value and return the index of the match.

Syntax:

ListFindFirst(list, find)

where:

  • list is a variable of type NUM[], STRING[], or RANGE.
  • find is the value to search for or a variable of the same type as list that contains the values to search for in list. If you are searching for a string value, you must enclose it in double quotation marks.

Syntax example:

CREATE VARIABLE myList1[] AS STRING

CREATE VARIABLE nResult AS NUM

CREATE VARIABLE bResult AS NUM

CREATE VARIABLE sValue AS STRING

 

SET VARIABLE myList1 = "a|b|c|d|e|f"

SET VARIABLE sValue = "d"

SET VARIABLE nResult = ListFindFirst(myList1, sValue)

SET VARIABLE bResult = ListFindFirst(myList1, "b")

 

// In this example, nResult equals 4 and bResult equals 2.

For an optimal Community experience, Please view on Desktop