Filtering Data in a form Using Date

How to I filter data in the Form using the FromDAte and ToDate (both are string edit) and the button is FilterDatabyDate.

0160.form.jpg

I need to figre out the code in the Execute method at the Data source level. Can someone please help?

The Data I am filtering on is InvoiceDate and is not displayed in the form…

Thanks

Chitanya

Why don’t you let users to use usual features for filtering data, such as Filter by grid? What advantage will you get by duplicating the functionality.

Alternatively, look at How to: Add Filter Controls to a Simple List Form.

And if you insist on your won code, simply create a query range and set its value.

For example:

executeQuery()
{
    QueryBuildRange qbr;

    qbr = SysQuery::findOrCreateRange(this.queryBuildDataSource(), fieldNum(...));
    qbr.value(queryValue(FromDate.dateValue()));
    super();
}

AX is full of real-life example, simply search form them if needed.

If the reason why you’re doing it because the field is not displayed, press Ctrl+F3 and set a filter there.