I have a custom form which has two datasouces. Lets say to make it easer that my form has the Salestable and SalesLines datasources.
for example I could say that I have a filter which is bounded with the ItemGroup edt .
I want to filter the SalesTable Datasource through this filter in order to 'show' in a grid which is connected with the SalesOrders datasouce :
''all SalesOrders which 'have' saleslines with saleslines.ItemGroup == somethingfromFilter''.
Whatever I tried is faild. Can someone help me?
FYI: the datasources properties I asume that are proper linked: SalesLine.JoinSource = SalesTable All of my tries was in modified method of the filter.
I will assume you have an ItemGroupId
field in the SalesLine
table.
This is not standard.
Also I will assume you have a filter field in the form called ItemGroupIdCtrl
.
Add a helper datasource SalesLineEx
:
In the SalesTable
datasource executeQuery
modthod:
public void executeQuery()
{
SysQuery::findOrCreateRange(salesLineEx_ds.queryBuildDataSource(), fieldNum(SalesLine,ItemGroupId)).value(ItemGroupIdCtrl.text());
salesLineEx_ds.queryBuildDataSource().enabled(ItemGroupIdCtrl.text() != '');
super();
}
This will check the existence of sales lines with a matching field if the filter field has a value. If no value is entered the filtering datasource is disabled.
Most likely you will want to research after change of filter value:
public boolean modified()
{
boolean ret = super();
salesTable_ds.executeQuery();
return ret;
}