Quantcast
Channel: Dynamics User Group
Viewing all articles
Browse latest Browse all 15740

SubTotal in report

$
0
0

 

This is my report I developed this through code but I'm not getting sub totals for each accountNum records.I want the output through code not by setting properties like SumAll = Yes

I wrote this fetch method,

public boolean fetch()

{

    Query                       q;

    QueryBuildDataSource        qbd,qbd2;

    QueryBuildRange             qbr;

    QueryRun                     qr;

    ;

    q = new Query();

    qbd = q.addDataSource(tablenum(CustTable));

    qbd2 = qbd.addDataSource(tablenum(CustTrans));

    qbr = qbd.addRange(fieldnum(CustTable,AccountNum));

    qr = new QueryRun(q);

     while(qr.next())

    {

        if(custTable.AccountNum == custTrans.AccountNum)

        {

        custTable = qr.get(tablenum(CustTable));

        accountNum = custTable.AccountNum;

        element.execute(1);

        custTrans  = qr.get(tablenum(CustTrans));

        amountMST  = CustTrans.AmountMST;

        element.execute(2);

         subtotal = custTrans.AmountMST;

         subTotal1 = subTotal1 + subTotal;

        element.execute(3);

         }

    subTotal1 =0;

    }

     return true;

}

I'm not getting exact output what I want .please help me to solve this ASAP.


Viewing all articles
Browse latest Browse all 15740

Trending Articles