PXSelect Classes
In traditional business query language (BQL), you define a data view or request database data in code by using one of the PXSelect classes (that is, the classes derived from PXSelectBase).
PXSelect Classes
The instances of PXSelect classes are complex objects containing the following:- A reference to the PXView object instantiated to process the data query
- A reference (through the PXView object) to the Select object, which is the business query language (BQL) command to be executed
- A reference to the graph
- A reference to the cache of the data access class (DAC) type that is specified in the first type parameter of PXSelect
Types of PXSelect Classes
The first type parameter of all PXSelect classes is a data access class (DAC) generally bound to a database table. The resulting SQL query selects records from this table. Other type parameters (such as Where, OrderBy, Join, and Aggregate) are optional and represent clauses that can be added to the basic select statement.
Depending on the clauses that will be used in a query, you select the appropriate variant of the PXSelect class.
For example, if you need to use the Where, OrderBy, and Join clauses, you can use the PXSelectJoin<Table, Join, Where, OrderBy> class to create the query, as shown in the following BQL sample code.
PXSelectJoin<Table1,
LeftJoin<Table2, On<Table2.field2, Equal<Table1.field1>>>,
Where<Table1.field3, IsNotNull>,
OrderBy<Asc<Table1.field1>>>
[list of
columns]
is the list of columns of the joined tables.
SELECT [list of columns] FROM Table1
LEFT JOIN Table2 ON Table2.Field2 = Table1.Field1
WHERE Table1.Field3 IS NOT NULL
ORDER BY Table1.Field1
MYOB Acumatica Framework explicitly enumerates the columns of the database table in the SQL query. For details on which columns are enumerated, see Translation of a BQL Command to SQL.
For more information on how to use the BQL clauses, see To Select Records By Using Traditional BQL.
If you need to retrieve data as it is currently stored in the database, you use one of the PXSelect classes that has Readonly in its name, such as the PXSelectReadonly<Table> class, or any of the PXSelect classes that use aggregation, such as the PXSelectGroupBy<Table, Aggregate> class. Otherwise, the data retrieved from the database can be merged with the data currently stored in the cache. For more information on how the data is merged with the cache, see Merge of the Records with PXCache.
The List of PXSelect Classes
- PXSelect<Table, Where, OrderBy>
- PXSelect<Table, Where>
- PXSelect<Table>
- PXSelectGroupBy<Table, Aggregate>
- PXSelectGroupBy<Table, Where, Aggregate, OrderBy>
- PXSelectGroupBy<Table, Where, Aggregate>
- PXSelectGroupByOrderBy<Table, Aggregate, OrderBy>
- PXSelectGroupByOrderBy<Table, Join, Aggregate, OrderBy>
- PXSelectJoin<Table, Join, Where, OrderBy>
- PXSelectJoin<Table, Join, Where>
- PXSelectJoin<Table, Join>
- PXSelectJoinGroupBy<Table, Join, Aggregate>
- PXSelectJoinGroupBy<Table, Join, Where, Aggregate, OrderBy>
- PXSelectJoinGroupBy<Table, Join, Where, Aggregate>
- PXSelectJoinOrderBy<Table, Join, OrderBy>
- PXSelectOrderBy<Table, OrderBy>
- PXSelectReadonly<Table, Where, OrderBy>
- PXSelectReadonly<Table, Where>
- PXSelectReadonly<Table>
- PXSelectReadonly2<Table, Join, Where, OrderBy>
- PXSelectReadonly2<Table, Join, Where>
- PXSelectReadonly2<Table, Join>
- PXSelectReadonly3<Table, Join, OrderBy>
- PXSelectReadonly3<Table, OrderBy>