Promotic

FindValue - method of the PmaDataTable object

Description:
The method finds the row in the specified column that has (or doesn't have) the specified value.
Syntax:
Long FindValue(Long RowFrom, Variant vCol, Variant Value, Long FindType)
Parameters:
RowFrom(Long) Number of the row from which the search starts (including this row).
The value >=0 means that it is the row index (zero-based index).
The value -2 means the last row.
vCol(Variant) Specifies the column in which values of rows have to be compared. Must be of the String type or the integer.
If it is of the String type, then it is the name of the column.
If it is the integer >=0, then it is the column index (zero-based index).
The -2 value 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 characters in texts are compared. The number of initial characters equals to the number of characters in the searched value (in the Value parameter). It 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. It 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 of the Value parameter is searched.
Return value:

If it finds, then it returns the index of the found row.
If it doesn't find the row, then it returns the negative value.
Example:
Search for 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 item of the INFO system.
JavaScriptVBScriptSelect and copy to clipboard

var oDataTable = pMe.Pm("/DataTable");
var nF = -1;
do
{
nF = oDataTable.FindValue(nF + 1, 0, "hHcC", 1 + 2 + 112);
if (nF >= 0)
{
Pm.Debug("Find row=" + nF);
}

} while (nF >= 0);
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.