AppRecord ReadWithWhere() Method

(SBM On-Premise/PaaS only) Used to find a record by passing in a string containing a SQL "where" clause, not including the keyword "where".

Function Signature

 bool ReadWithWhere( whereClause [, Vector queryParams] )

Parameters

Parameter Type Description

whereClause

string

The SQL "where" clause to find the specific record in the table, not including the keyword "where".

queryParams

Vector

queryParams is an optional Vector storing SQL bind parameters, where each entry is a Pair, where the first value is the parameter type and the second value is the value to bind to the SQL parameter.

For the type parameter, use DBTypeConstants.

Return

Type Description

bool

Returns true if the method found the record, in which case the calling object becomes a copy of the record found. If more than one record is found, the first one is copied to the calling object.

Technical Details

SBM ModScript version: 11.3.

Example

var record = Ext.CreateAppRecord(Ext.TableId("TS_CONTACTS"));
var whereClause = "TS_CONTACTFIRSTNAME = 'Joe'";
myRecord.ReadWithWhere(whereClause);

Or:

var record = Ext.CreateAppRecord(Ext.TableId("TS_GROUPS"));
record.ReadWithWhere("TS_NAME = ?", [Pair(DBTypeConstants.VARCHAR,"Everyone")]);

Notes

All fields will start with "TS_" and normal SQL syntax will apply. The calling object will become a copy of the first record found. This is the most general way of finding particular AppRecords.

Related Topics

AppRecord