addSortField on multiple tables

This post has 1 Reply | 1 Follower

1 Posts
11 Points
Joined: 2009-3-19
Last Online:
2009-3-24 17:03
Location: Italu
Andrea Posted: 2009-3-19 14:54 | Locked

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
I tried adding this code to the original query (querySum):
                    qbD = querySum.dataSourceTable(tablenum(InventDim));
                    qbd3 = qbD.addDataSource(tablenum(InventBatch));
                    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.


2,161 Posts
47,333 Points
Joined: 2003-1-21
Last Online:
2015-9-28 19:04
Location: Herts, England
Harish Mohanbabu replied on 2009-3-24 12:37 | Locked

Hi Andrea,

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

Hope this helps,

Harish Mohanbabu
Long way to go before I sleep ..

View Harish Mohanbabu's profile on LinkedIn

  • | Post Points: 5
Page 1 of 1 (2 items) | Get this RSS feed