provides a demonstration using these classes.
This example demonstrates how to use the Query classes to build a query.
1. Add a class to the AOT called QueryClassDemo.
2. Add a class method called createQueryRun().
3. Create a new Query object.
4. Add a new datasource for CustTable using Query.addDataSource().
5. Add a new range on CustTable.AccountNum usingQueryBuildDataSource.addRange().
6. Set a criteria on the range using QueryBuildRange.value().
7. Make the query sort by CustTable.CustGroup, usingQueryBuildDataSource.addOrderByField().
8. Create a QueryRun object based on the query.
9. Return the QueryRun object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public QueryRun createQueryRun() { Query query; QueryRun qr; QueryBuildDataSource qbds; QueryBuildRange qbr; query = new Query(); qbds = query.addDataSource(TableNum(CustTable)); qbr = qbds.addRange(FieldNum(CustTable, AccountNum)); qbr.value('4005'); qbds.addOrderByField(FieldNum(CustTable, CustGroup)); qr = new QueryRun(query); return qr; } |
Best Regards,
Hossein Karimi
No comments:
Post a Comment