I'd like to be able to create a custom filter on a new form datasource which is a custom view I have created.
I've created a custom view, ABCPurchLineBusUnitView, (from a custom query that joins the PurchLine table to the DefaultDimension view) to append to an existing form's datasources (PurchLineOpenOrder). The DisplayValue column in the form's main grid is returning the Business Unit dimension value for all PurchLines.
Customising the form:-
In the init() method of the new datasource I have joined the view to the existing PurchLine datasource as follows:
public void init()
{
#DEFINE.DataSourceBusUnit(7)
QueryBuildDataSource qbds;
super();
qbds = this.query().dataSourceNo(#DataSourceBusUnit);
qbds.clearLinks();
qbds.joinMode(JoinMode::InnerJoin);
qbds.relations(true);
qbds.addLink(fieldNum(PurchLine,RecId),fieldNum(ABCPurchLineBusUnitView,RecId));
qbrBusinessUnit = qbds.addRange(fieldNum(ABCPurchLineBusUnitView, DisplayValue));
}
In the executeQuery() method of the same datasource I've set a hard-coded range value to bring back only those PurchLines that relate to a particular Business Unit.
public void executeQuery()
{
qbrBusinessUnit.value(queryValue('Business unit name here'));
super();
}
The displayed column works fine. However, using CTRL+G to view the user filter it is clear that the filter value is not present and has not been applied.
On the same form, when I apply a filter on an existing datasource it works fine using the above technique which is confusing.
Also, I would like this to work on an outer-joined datasource and have tried using QueryFilters but no luck there either using the same datasource methods.