Hello everyone,
I recently was using the query builder classes and wanted to see the sorting managed.
I found that when using the SortOrder static method there was no difference in direction when specifying Descending.
Does anyone know why in this block of code the sort order does not matter?
Here is a simple code sample you can run in a job.
static void Cyborg3QueryBuild2(Args _args)
{
Query query;
QueryRun qr;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
VendTable vendTable;
query = new query();
qbds = query.addDataSource(tableNum(vendTable));
qbr = qbds.addRange(fieldNum(vendTable, VendGroup));
qbr.value('10');
//here is the line where I thought I could control the sort direction
qbds.addSortField(fieldNum(vendTable, AccountNum),SortOrder::Ascending);
qr = new QueryRun(query);
if(qr.prompt())
{
while(qr.next())
{
vendTable = qr.get(tableNum(vendTable));
info( vendTable.AccountNum);
}
}
}
*This post is locked for comments
I have the same question (0)