Promotic
WikipediaLinkedInYoutubeTwitterFacebook

FindValue - method of object PmDataTable

Description:
The method finds the row in the specified column that has (or doesn't have) the specified value.
Syntax:
FindValue(RowFrom As Long, vCol As Variant, Value As Variant, FindType As Long) As Long
Calling:
n = oDataTable.FindValue(RowFrom, vCol, Value, FindType)
Parameters:
RowFrom(Long) Number of row from which the search starts (including this row).

Value >=0 means it is the row index (zero-based index).

Value -2 means the last row.

vCol(Variant) Identification of the column in which values of rows have to be compared. It must be of the String type or the integer.

If it is the String, then it is the name of the column.

If it is the integer >=0, then it is the column index (zero-based index).

Value -2 means the last column.

Value(Variant) Searched value. The data type of this value should be the same as the data type of the column.
FindType(Long) Search type. If it is 0, then it is searched from the specified row forward (including this row) and the row with the same value that the Value parameter holds, is searched. The following values can be added (some combination logically can't be added) and thus the search type can be changed:
1 - If the value is a text (String data type), then for example "abc" and "aBc" are regarded as the same texts (case insensitive text).
2 - If the value is a text (String data type), then only the initial chars in texts are compared. The number of initial chars equals to the number of chars in the searched value (in the Value parameter). This means that if the text "abc" is in the searched value, then, for example, the following texts equal to it: "abcxy", "abc", "abc xy", etc.
4 - If the value is a text (String data type), then the searched value is compared with the text inside the cell of the row. This means that if the text "abc" is in the searched value, then, for example, the following texts equal to it: "xyabcz", "abc", "xabc", etc. This search type cannot by combined with the type 2.
8 - searching from the specified row backward (including this row)
16 - the row with the value less or equal to the value of the Value parameter is searched.
32 - the row with the value greater or equal to the value of the Value parameter is searched.
80 - the row with the value less than the value of the Value parameter is searched.
96 - the row with the value greater than the value of the Value parameter is searched.
112 - the row with another value than the Value parameter is searched.
Return Values:
If it finds, then it returns the number of the found row. If it doesn't find the row, it returns the negative value.
Example:
We'll find all rows that don't have the value starting at "hhcc" (case insensitive text) in the zero column. Found rows are written into the Debug_info item of the INFO system.
Dim nF
nF = -1
Do
  nF = oDataTable.FindValue(nF+1, 0, "hHcC", 1+2+112)
  If nF>=0 Then Pm.Debug "Find row=" & nF
Loop While nF>=0
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice