Adding a Filter to a Field on a Form - arp6333/xplusplus GitHub Wiki
In the init() method of the form:
public void init()
{
QueryFilter qFilter;
QueryBuildDataSource qbd;
super();
// Add QBDS and QFilter to the datasource object ('SalesList_DS' in this case)
qbd = SalesList_DS.queryBuildDataSource();
// Declare which field to filter ('Status' in 'SalesList' in this case)
qFilter = SalesList_DS.query().addQueryFilter(qbd, fieldstr(SalesList, Status));
// Value to filter ('not a value of 2' in this case)
qFilter.value('!2');
}