IDataStore.FindIndex(string expression, DwBuffer dwBuffer = DwBuffer.Primary) Method
.NET Standard 2.x | Current Version (1.0.1) 
Returns the index number of the next row in the specified buffer of the DataStore in which data meets the condition specified by the expression. The primary buffer is specified by default.
Namespace: PowerBuilder.Data
Assembly: PowerBuilder.Data.dll
Syntax
int FindIndex(string expression, DwBuffer dwBuffer = DwBuffer.Primary);
Parameters
expression System.String
A string whose value is a Boolean expression that you want to use as the search criteria. The expression includes column names.
dwBuffer PowerBuilder.Data.DwBuffer
The buffer in which to find the row.
It is specified to the primary buffer by default.
Returns
System.Int32
Returns the zero-based index number of the row found.
Returns -1 if no row is found.
Examples
The following code example demonstrates how to return the index number of the department record by a string expression.
using PowerBuilder.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class FindIndexExample
{
private SchoolContext _context;
public FindIndexExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example3()
{
// Instantiates a DataStore object with datawindow: d_department.
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
// The first record in the Department table is found:
// departmentid=1, name=Engineering
var findrow = datastore.FindIndex("departmentid < 3", DwBuffer.Primary);
Console.WriteLine("Department ID: {0}; Department Name: {1}",
datastore.GetItem<int>(findrow, "departmentid"),
datastore.GetItem<string>(findrow, "name"));
/*This code produces the following output:
Department ID: 1; Department Name: Engineering
*/
}
}
}
Applies to
.NET Standard
2.x