
Consider we are going to build a Inquiry form, where we are applying different filter criteria’s.
One of them is date time filter. Consider this post is second part of one of my previous post. Where we created filter on Sales line.
For this filter add two utcdatetimeEdit control and set auto declaration to true so these control accessible in code. Set first Name is From_Date and second Name is To_Date.
Now drag and drop shippingDateConfirm field to Grid.
Now In DataSource Execute Query Method which we over write in previous post add following lines
public void executeQuery()
{
QueryBuildRange QcustomerFilter;
QueryBuildRange ShippingDateConfirmedFileter;
QcustomerFilter = SysQuery::findOrCreateRange(SalesLine_q.datasourceTable(tableNum(SalesLine)),fieldNum(SalesLine,CustAccount));
ShippingDateConfirmedFileter = SysQuery::findOrCreateRange(SalesLine_q.datasourceTable(tableNum(SalesLine)),fieldNum(SalesLine,ShippingDateConfirmed));
if (txtCustomerNumber.text()!=””)
{
QcustomerFilter.value(queryValue(txtCustomerNumber.text()));
}
else
{
QcustomerFilter.value(SysQuery::valueUnlimited());
}
if (to_date.dateTimeValue() !=utcdatetimenull() && from_date.dateTimeValue() !=utcdatetimenull())
{
ShippingDateConfirmedFileter.value(SysQuery::range(from_date.dateTimeValue(),to_date.dateTimeValue()));
}
else
{
ShippingDateConfirmedFileter.value(SysQuery::valueUnlimited());
}
//ShippingDateConfirmed
super();
}
Now run the form , It look likes
Now click on button to apply the new added filter