Showing posts with label Filtering of grid data using date filters in form.. Show all posts
Showing posts with label Filtering of grid data using date filters in form.. Show all posts

Friday, 30 October 2015

Filtering of grid data using date filters in form.

  • I created a form using salesline as data source.Add fileds in grid under the design node.
  • In design node add group.In that group add 2 utcdatetime controls. Add one more button in this group.
  • Now create a grid and drag and drop the fields what ever you want into the grid from data source.
  • override the execute query method in form data source methods.

public void executeQuery()
{
    Query query = new Query();
    QueryBuildDataSource  qbds;

    QueryBuildRange qbr;

    qbr = SysQuery::findOrCreateRange(SalesLine_q.datasourceTable(tableNum(SalesLine)),
    fieldNum(SalesLine,ShippingDateConfirmed));
    if (ToDate.dateTimeValue() > FromDate.dateTimeValue() )

    //if (ToDate.dateTimeValue() !=utcdatetimenull() && FromDate.dateTimeValue() !=utcdatetimenull())
        {

        qbr.value(SysQuery::range(FromDate.dateTimeValue(),
        ToDate.dateTimeValue()));
        super();
        }
    else
        {
        qbr.value(SysQuery::valueUnlimited());

        }
}

  • Override clicked method in the button.

void clicked()

{ 
    super();
    SalesLine_ds.executeQuery();

}


  • Make sure that the allow declaration property for the controls are yes.
  • Also keep the arrange method property as Horizontal, flush right for group controls.