on form class declaration
public class FormRun extends ObjectRun
{
QueryBuildRange indentTransDateRange;
QueryBuildRange invoiceDateRange;
QueryBuildRange customerRange;
QueryBuildRange storeRange;
}
on init form method
public void init()
{
super();
indentTransDateRange = TIDIndentOrderUninvoiceTrans_ds.query().dataSourceTable(tablenum(TIDIndentOrderUninvoiceTrans))
.addRange(fieldnum(TIDIndentOrderUninvoiceTrans, PaymentTransDate));
invoiceDateRange = TIDIndentOrderUninvoiceTrans_ds.query().dataSourceTable(tablenum(TIDIndentOrderUninvoiceTrans))
.addRange(fieldnum(TIDIndentOrderUninvoiceTrans, InvoicePostingDate));
customerRange = TIDIndentOrderUninvoiceTrans_ds.query().dataSourceTable(tablenum(TIDIndentOrderUninvoiceTrans))
.addRange(fieldnum(TIDIndentOrderUninvoiceTrans, CustAccount));
storeRange = TIDIndentOrderUninvoiceTrans_ds.query().dataSourceTable(tableNum(TIDIndentOrderUninvoiceTrans))
.addRange(fieldNum(TIDIndentOrderUninvoiceTrans, Store));
TransactionDate.dateValue(systemdateGet());
}
on execute Query datasource form
public void executeQuery()
{
this.Query().clearGroupBy();
indentTransDateRange.value(strFmt('<%1',(TransactionDate.dateValue() + 1)));
invoiceDateRange.value(strFmt('>%1',TransactionDate.dateValue()));
customerRange.value(strFmt(customer.text()+'*'));
storeRange.value(strFmt(StoreId.text()+'*'));
this.Query().DataSourceNo(1).addGroupByField(fieldNum(TIDIndentOrderUninvoiceTrans,Store));
this.Query().DataSourceNo(1).addGroupByField(fieldNum(TIDIndentOrderUninvoiceTrans,CustAccount));
this.Query().DataSourceNo(1).addGroupByField(fieldNum(TIDIndentOrderUninvoiceTrans,SalesId));
this.Query().DataSourceNo(1).addGroupByField(fieldNum(TIDIndentOrderUninvoiceTrans,GrossAmount));
this.Query().DataSourceNo(1).addSelectionField(fieldNum(TIDIndentOrderUninvoiceTrans,SumOfamountTendered),SelectionField::Sum);
this.Query().DataSourceNo(1).addSelectionField(fieldNum(TIDIndentOrderUninvoiceTrans,OutstandingAmount),SelectionField::Sum);
super();
}
