Hi,
I'm trying to filter the LocationId(lookup using query) field where LocationRoles is service.
I've created the following query which filters the LocationId
Query query = new Query(); QueryBuildDataSource qbds; QueryBuildDataSource qbdsJoin; QueryBuildDataSource qbdsJoin2; QueryBuildDataSource qbdsJoin3; QueryBuildDataSource qbdsJoin4; int64 locationroleid = 5637144580; SalesTable salestable; SysTableLookup sysTableLookup = sysTableLookup::newParameters( tableNum(LogisticsLocation),sender); QueryRun queryrun; qbds= query.addDataSource( tableNum(LogisticsLocation)); qbdsJoin= qbds.addDataSource( tableNum(DirPartyLocation)); qbdsJoin2= qbdsJoin.addDataSource( tableNum(DirPartyTable)); qbdsJoin3 = qbdsJoin2.addDataSource( tableNum(CustTable)); qbdsJoin4 = qbdsJoin.addDataSource( tableNum(DirPartyLocationRole)); qbdsJoin.relations( true); //If relations are defined in the table then set it to true. qbdsJoin2.relations( true); qbdsJoin3.relations( true); qbdsJoin4.relations( true); FormRun form = sender.formRun(); FormDataSource salestable_ds = form.dataSource(formDataSourceStr(SalesTable,SalesTable)) as FormDataSource; salestable= salestable_ds.cursor(); sysTableLookup.addLookupfield(fieldNum(LogisticsLocation,LocationId)); sysTableLookup.addLookupfield(fieldnum(LogisticsLocation,Description)); qbdsJoin3.addRange(fieldNum(CustTable,AccountNum)).value(queryValue(salestable.CustAccount)); qbdsJoin4.addRange(fieldNum(DirPartyLocationRole, locationRole)).value(int2Str(locationroleid)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs; //cancel super() to prevent error. ce.CancelSuperCall();
*This post is locked for comments