SBM ModScript Reference → Programming SBM ModScript → Object Types → AppRecordList → AppRecordList ReadWithWhere() Method
(SBM On-Premise/PaaS only) An alternative to Read(), this method uses SQL to select only certain records from the calling AppRecordList's table, rather than reading the entire table.
bool ReadWithWhere( whereClause ) bool ReadWithWhere( whereClause, orderBy ) bool ReadWithWhere( whereClause, orderBy , AppRecord templateRec ) bool ReadWithWhere( whereClause, Vector params ) bool ReadWithWhere( whereClause, Vector params, orderBy ) bool ReadWithWhere( whereClause, Vector params, orderBy, AppRecord templateRec )
Parameter | Type | Description |
---|---|---|
whereClause |
string |
A SQL "where clause" specifying the records to find. SBM will build a SQL string requesting all fields for the calling AppRecordList's table. The string contents of whereClause will appear after the word "where" in this SQL statement. |
params |
Vector |
Params is an optional Vector storing SQL bind parameters, where each entry is a Pair, with the first value as the parameter type and the second value as the value to bind to the SQL parameter. See Pair, Map_Pair, and Dictionary_Pair. For the type parameter, use DBTypeConstants. |
orderBy |
string |
Identifies a column used for ordering the AppRecordList. To use the templateRec parameter without the orderBy parameter, use an empty string as a parameter for the orderBy parameter. |
templateRec |
AppRecord |
Optional. Identifies which fields are read into all AppRecords in the AppRecordList. Using this parameter may improve performance when using AppRecordOjbects which contain a VarFieldList from Primary or Auxiliary tables. To use this optional parameter, create a VarRecord against the Primary table you are doing your ReadWithWhere against. Get the VarFieldList of that VarRecord through the Fields() method. Call SelectAll, and pass it false to clear all fields. Then, explicitly turn on the fields you wish to read by finding the Field on the VarFieldList, and then calling that Field's Select() method and passing it true. |
Type | Description |
---|---|
bool |
Returns true if successful; false otherwise. A successful read may return zero results if no items match the query. Check for results by calling the AppRecordList.empty() method. |
SBM ModScript version: 11.3.
/*ReadWithWhere with optional "params" parameter and using DBTypeConstants*/ var list = Ext.CreateAppRecordList(Ext.TableId("UBG_ISSUES")); list.ReadWithWhere("TS_ID between ? and ?", [ Pair(DBTypeConstants.INTEGER,3), Pair(DBTypeConstants.INTEGER,20)], "TS_TITLE ASC" ); for (item : list) { Ext.WriteStream("Item: " + item.GetName()); }
None.
Copyright © 2007–2019 Micro Focus or one of its affiliates. All rights reserved.