Is it possible to sort a while select common order by (any field)
-----------This is what I have tried so far-----------
t = new DictTable(tablename2id(tableName));
common = t.makeRecord();
fieldId = t.fieldName2Id(‘name’);
while select forupdate common order by fieldnum(custtable,name)
{
info(‘column’);
}
I don’t think it’s possible. If you know that the table is CustTable, cast the common variable to CustTable and use it as usually. If you need a generic solution, use the Query framework instead of the while select:
TableId tableId = tableName2Id(tableName);
Query query = new Query();
QueryBuildDataSource ds = query.addDataSource(tableId);
QueryRun qr;
Common common;
;
ds.addSortField(fieldNum(CustTable, Name));
ds.update(true);
while (qr.next())
{
common = qr.get(tableId);
// ...
}