Thursday, 30 March 2017

How to get query sum value using X++ code in ax 2012

How to get query  sum value using X++ code in ax 2012 


static void querySumCustAmountMST(Args _args)
{
    Query                               q;
    QueryBuildDataSource                qbds;
    queryBuildRange                     qbr;
    QueryRun                            qr;
    CustTrans                           custTrans;

    q                                   = new Query();

    qbds    = q.addDataSource(tablenum(CustTrans));
    qbds.addSelectionField(fieldNum(CustTrans,AmountMST),SelectionField::Sum);
    qbr     = qbds.addRange(fieldNum(CustTrans,AccountNum));

    qbr.value(strfmt("1001"));
    qr = new QueryRun(q);
    
    while(qr.next())
    {
        custTrans   =   qr.get(tablenum(CustTrans));
        info(strfmt("%1",custTrans.AmountMST));
    }
}


Tuesday, 21 March 2017

How we can add custom Lookup on Morphx Report Dialog Box in ax 2012


How we can add custom Lookup on Morphx Report Dialog Box in ax 2012


Please find the Link for your reference.

https://dynamicsuser.net/ax/f/developers/92265/how-we-can-add-custom-lookup-on-morphx-report-dialog-box/486844#486844

You can get solution from this link.


Sunday, 5 March 2017

Like and Not like operation in ax 2012


Like and Not like operation in ax 2012

For Like operation:

static void likeOperation(Args _args)
{
    CustTable                         custTable;
    
    while select custTable where custTable.AccountNum like "1101"
    {
        info(custTable.AccountNum);
    }
}

For Not Like operation:

static void NotlikeOperation(Args _args)
{
    CustTable                         custTable;
    
    while select custTable where !(custTable.AccountNum like "1101")
    {
        info(custTable.AccountNum);
    }
}

Thank you

Thursday, 2 March 2017

Data getting using queries in ax 2012


Data getting using queries in ax 2012

static void AddRangeToQuery(Args _args)
{
    Query                               q = new Query();
    QueryRun                        qr;
    QueryBuildDataSource    qbr1,qbr2;
    str                                     strTemp;
    HPRWebUsers                 webUsers,webUsers2;
    EmplTable                        emplTable;
    ;
 
    qbr1 = q.addDataSource(tablenum(EmplTable));
    qbr1.addRange(fieldNum(EmplTable, EmplId)).value("f08*");
   
    qr = new QueryRun(q);

    while (qr.next())
    {
        emplTable = qr.get(tablenum(EmplTable));
        info(empltable.EmplId);
    }
}

Thank you...!