How to order form grid by field that is not included in the data source

So this can be done by updating a query method init of the data source on which grid is based:

 

 QueryBuildDataSource qbds;
 QueryBuildDataSource qbds2;
 //...
 QueryBuildDataSource qbdsn;

 super();
//original data source
qbds = DataSource_ds.query().dataSourceTable(tableNum(DataSourceTable));
 

 qbds2 = qbds.addDataSource(tableNum(OtherTable));
 qbds2.addLink(fieldNum(DataSourceTable,RecId),fieldNum(OtherTable,DataSourceTableRecId));
//...
 qbdsn = qbdsn-1.addDataSource(tableNum(OtherTableN));
 qbdsn.addLink(fieldNum(OtherTableN-1,Recid),fieldNum(OtherTableN,OtherTableN-1Recid));
 qbdsn.addSortField(fieldNum(OtherTableN, FieldYouWantToSortOn));
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s