Filtering Parameters: Filtered Data on an Inquiry Form

To display the filtered data in the table on an inquiry form, you need to define the data view that selects data narrowed by the selection criteria, which is defined with filtering parameters.

To select data, you should specify filtering conditions in the Where clause of the data view type. To pass the current filter values to the query, you specify the filter DAC fields within the Current parameter. You have to define the data view that retrieves filtered records for the UI after the definition of PXFilter data view because the data view that retrieves filtered records uses the Current values of the PXFilter data view.

In the following code example, the Filter data view provides the CountryCD and MinOrderQty filtering parameters. The SupplierProducts data view selects the records that meet the criteria specified by the filtering parameters.

public class SupplierInq : PXGraph<SupplierInq>
{
    public PXCancel<SupplierFilter> Cancel;
    public PXFilter<SupplierFilter> Filter;

    [PXFilterable]
    public SelectFrom<SupplierProduct>
     .InnerJoin<Supplier>
       .On<Supplier.supplierID.IsEqual<SupplierProduct.supplierID>>
     .Where<
       Brackets<
        SupplierFilter.countryCD.FromCurrent.IsNull
        Or<Supplier.countryCD.IsEqual<SupplierFilter.countryCD.FromCurrent>>>
       .And<
        Brackets<SupplierFilter.minOrderQty.FromCurrent.IsNull
        .Or<SupplierProduct.minOrderQty.IsGreaterEqual
           <SupplierFilter.minOrderQty.FromCurrent>>>>>
     .OrderBy<
       SupplierProduct.productID.Asc,
       SupplierProduct.supplierPrice.Asc,
       SupplierProduct.lastPurchaseDate.Desc>
      .View.ReadOnly
    SupplierProducts;
}
Tip: You can use a read-only type of the data view that retrieves filtered data records. For a read-only data view, the framework automatically disables the editing of rows in the grid.