in earlier courses in the context of the AOT. This section discusses these
elements from within the context of X++. Elements include datasources, ranges,
and sort fields which build upon each other.
There are two more classes to note before building a query:
• QueryBuildDataSource
• QueryBuildRange
QueryBuildDataSource
Data sources are what queries are built upon. They are arranged in a hierarchy
and define the sequence in which records are fetched from tables assigned to the
data source. The following example adds a data source to a query using X++:
1 2 3 | Query query = new Query();
QueryBuildDataSource qbds =
query.addDataSource(TableNum(SalesTable));
|
Notice that the data source is an object, but the query object, 'query', requires a
method to add this data source to the query and assign the SalesTable to the data
source.
QueryBuildRange
A QueryBuildRange object is embedded within a data source of a query and
defines which records should be selected from the data source. A querybuild
range is built upon a QueryBuildDataSource object. The following example
uses the QueryBuildRange:
1 2 3 4 5 | Query query = new Query();
QueryBuildDataSource qbds =
query.addDataSource(TableNum(SalesTable));
QueryBuildRange qbr =
qbds.addRange(FieldNum(SalesTable,CustAccount));
|
Best Regards,
Hossein Karimi
No comments:
Post a Comment