Thursday 23 October 2014

Dynamic Selection in Form

Dynamic Selection in Form


1. On the Class Declaration of the form, add a query filter

    public class FormRun extends ObjectRun
   {
        QueryFilter queryFilterCustId;
    }

2. On the Data Sources ladder of the form, override the init method, note that it has the _ds extension

    public void init()
   {
        super();
        queryFilterCustId = WMPPickingLines_ds.query().addQueryFilter(WMPPickingLines_ds.queryBuildDataSource(),"CustAccount");

    }

3. Change the Control that will be used for the filter to have the property of AutoDeclaration set to Yes 

4. Override the modified method of the control to trigger the query

    public boolean modified()
   {
        boolean ret;
        WMPPickingLines_ds.executeQuery();
        return ret;
    }

5. On the Data Sources ladder of the form, override the executeQuery method, not that the controlName is required (in this case "CustomerId"). ValueStr is the method for getting a value from a drop-down.

public void executeQuery()
{

    QueryFilterCustId.value(element.design().controlName("CustomerId").valueStr());
    super();


No comments:

Post a Comment