ListFindKeyValueString

InstallShield 2014 ยป InstallScript Language Reference

The ListFindKeyValueString function searches a string or number list for a specified value. It returns a value from an additional list that corresponds with the position of the found string in the first list. This enables you to search lists of key-value pairs for a particular key and get the corresponding value.

Syntax

ListFindKeyValueString (byval LIST listKeys, byval LIST listValues, byval string szKey, byref string svValue);

Parameters

ListFindKeyValueString Parameters

Parameter

Description

listKeys

Indicate the list of keys to be searched. You can specify a string or number list. The list must be initialized by calling ListCreate before calling ListFindKeyValueString.

Note that the starting point for the search is always the beginning of the list, regardless of the current position of the list. When the function returns, the current position in the list is the found element.

listValues

Indicate the list of values that corresponds with the list of keys. You can specify a string or number list. The list must be initialized by calling ListCreate before calling ListFindKeyValueString.

Note that listKeys and listValues do not necessarily need to be the same type of list.

szKey

Specify the string for which you want to search.

If listKeys is a number list, szKey is converted to a number by using the StrToNum function, which is then used to search the list.

ListFindKeyValueString calls ListFindString (if the list is a string list) or ListFindItem (if the list is a number list) to search the list. Searches for string lists are case-sensitive, since ListFindString performs case-sensitive searches.

svValue

The value from the second list is returned in this parameter. If listValues is a number list, the number is converted to a string using NumToStr and then passed back as a string.

Return Values

 

Return Value

Description

0

The function successfully found the requested element.

< 0

An error prevented the function from searching the specified list. This error occur, for example, if the list specified by listID does not exist.

END_OF_LIST (1)

The function searched to the end of the list and did not find the requested element.

ISERR_LIST_NOSUCHLIST (-501)

A list with the specified ID does not exist. Valid list IDs are return values from the ListCreate function.

See Also