staticvoidDuyDang_QueryFilter(Args_args){Queryquery;QueryBuildDataSourceqbds,qbds1;QueryRunqueryRun;DuyDang_ParentTableparentTable;DuyDang_ChildTablechildTable;QueryFilterqFilter;QueryBuildRangeqRange;structstructSet;structSet=newstruct("str ParentID;"+"str ChildID;"+"real Quantity");query=newQuery();qbds=query.addDataSource(tableNum(DuyDang_ParentTable));qbds1=qbds.addDataSource(tableNum(DuyDang_ChildTable));qbds1.joinMode(JoinMode::OuterJoin);// Set join type. qbds1.addLink(fieldNum(DuyDang_ParentTable,ID),fieldNum(DuyDang_ChildTable,ParentID));qRange=qbds1.addRange(fieldNum(DuyDang_ChildTable,Qty));qRange.value(queryValue(15));queryRun=newQueryRun(query);while(queryRun.next()){parentTable=queryRun.get(tableNum(DuyDang_ParentTable));childTable=queryRun.get(tableNum(DuyDang_ChildTable));structSet.value("ParentID",parentTable.ID);structSet.value("ChildID",childTable.ID);structSet.value("Quantity",childTable.Qty);info(structSet.toString());}}
and result info here:
We can see the difference between them
When you use QueryFilter class, the restriction is in the WHERE clause of the OUTER JOIN in the ANSI SQL select statement that is generated by the AOS for the underlying database system.
When you use QueryBuidRange class, the restriction is in the ON clause of the OUTER JOIN in the ANSI SQL select statement that is generated by the AOS for the underlying database system.