A complex scenario

Guys. I am currently changing the customer ageing report in the Accounts Receivable. My client wants to pass another parameter for ItemGroup. This will make the report filter not only the customers but the Transactions/Vouchers as per the ItemGroup. I devised the following solution. Added a new parameter ITEMGROUP on the dialog without any issues. 2.Created a query which gives me Accountnum,Voucher,Transdate and ItemGroup (no duplicate records). Then i decided to populate a temporary table with that resultset which i passed to the Method-CalculateDetails of the class custBalanceListTransactionDate. I thought that i will be able to then filter the Custtrans records coming from the method and filter it by joining with my temp table. Here i have been stuck and don’t know what to do as the following code suggests that the data is already using another existing query. Void calculateDetails(CustTable _custTable, GS1_TmpCustInvoiceItemGroup _custInvItmGrp) { TransDate startDate; TransDate endDate; Counter numOfAge; CustTrans custTrans; CustSettlement custSettlement; custTransOpen custTransOpen; QueryRun queryRun = new QueryRun(queryStr(CustTransCustSettlementCustTransOpen)); ; tmpAccountSum = null; balanceDate = transactionDate; queryRun.query().dataSourceTable(tableNum(CustTrans)).findRange(fieldNum(CustTrans,accountNum)).value(queryValue(_custTable.accountNum)); queryRun.query().dataSourceTable(tableNum(CustTrans)).findRange(fieldNum(CustTrans,transDate)).value(queryRange(dateNull(),transactionDate)); queryRun.query().dataSourceTable(tableNum(CustSettlement)).findRange(fieldNum(CustSettlement,transDate)).value(queryRange(transactionDate + 1,dateMax())); queryRun.query().dataSourceTable(tableNum(custTransOpen)).findRange(fieldNum(custTransOpen,transDate)).value(queryRange(dateNull(),transactionDate)); while (queryRun.next()) { if (queryRun.changed(tableNum(CustTrans))) { custTrans = queryRun.get(tableNum(CustTrans)); custTrans.transactionPerDate(transactionDate); balanceAge[1] += custTrans.remainAmountMST(); } … so on Can you guys give me ideas on what i can do here.please note i have changed the signature of calculateDetails by adding my temporary table . A big thanks to anyone who can give me a practical idea. Cheers Amit Sood

Guys, Found the solution and in the end when i look at it was quite easy but didn’t strike me before.Here is what i have done. while (queryRun.next()) { custTrans = queryRun.get(tableNum(CustTrans)); //Added the following lines select _custInvItmGrp where _custInvItmGrp.AccountNum == custtrans.AccountNum && _custInvItmGrp.Voucher == custtrans.Voucher ; if(_custInvItmGrp.RecId) {… Anyways changing CustomerAgeing report was a challenge .The way it is implemented is very good but quite complex to understand. Cheers Amit Sood