addSortField on multiple tables

Hi all,
I have a query with 2 DataSources (InventSum & InventDim).
I would to add a third DataSource (InventBatch, joined to InventDim) and I
would to order the resulting recordset by a field in the InventBatch table
(expDate).
I tried adding this code to the original query (querySum):
                    qbD = querySum.dataSourceTable(tablenum(InventDim));
                    qbd3 = qbD.addDataSource(tablenum(InventBatch));
                    qbd3.fetchMode(QueryFetchMode::One2One);
                    qbd3.addlink(fieldnum(InventDim, inventBatchId),
fieldnum(InventBatch, inventBatchId));
                    qbd3.addSortField(fieldnum(InventBatch, expdate));

But it didn't work because the original query is already ordered by the
field InventBatchId (from the InventDim table), so my result is ordered first
by InventBatchId and then by expDate.
How can I "change" this order, sorting by expDate and then by InventBatchId?
Is it possibile to edit the sorting order or do the sorting fields of the
main table always take priority on the child table sorting fields?
And in this case is there a solution?

Thanks in advance for your help. Kind regards.

Andrea

  • Hi Andrea,

    Try calling two properties - clearSortIndex() and sortClear().   And then try setting up sort field.

    Hope this helps,

Related
Recommended