FindRowNum method: OptInterface class

Syntax

FindRowNum(&Record [, startrow [, endrow [, field_list]]])

Where field_list is a list of field names in the form:

[fieldname1 [, fieldname2]]...

Description

The FindRowNum method determines the row number of a row in the datacache rowset. You provide a record with key values, and this method finds the row with the same key values and returns its row number.

Parameters

Parameter Description

&Record

Specify a record with the same structure as the records that comprise the rowset, with its key fields populated.

startrow

Specify as an integer the starting row number of the search. Specify 0 to search from the first row in the rowset.

endrow

Specify as an integer the ending row number of the search. Specify 0 to search through the last row in the rowset.

fieldname

Specify the name of a field in the input record which contains a value to be matched. You can specify one or more field names, in any order.

Note: If you use this parameter, the fields specified here are used to search, instead of the record's key fields. Any value that doesn't correspond to a field name is ignored.

Returns

The row number of the row containing the specified key values, or 0 if no row is found.

Example

The following example searches the whole scroll to find the partial key OPT_SITE:

Local Record &rec = CreateRecord(Scroll.OPT_TRANSCOST);
Local Optineterface &oi;

&rec.OPT_SITE.value = "New York";
int nRowNum = &oi.FindRowNum(&rec, 0, 0, "OPT_SITE");

The following example searches from row 5 to row 15 with the full key values New York and San Jose:

Local Record &rec = CreateRecord(Scroll.OPT_TRANSCOST);
Local Optineterface &oi;

&rec.OPT_SITE.value = "New York";
&rec.OPT_STORE.value = "San Jose";
int nRowNum = &oi.FindRowNum(&rec, 5, 15);