Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Wednesday, July 17, 2013

Controller Class in Dynamic AX

Controller Class
public static CustController construct(Args _args)
{
    CustController controller=new CustController();
    controller.parmArgs(_args);
    return controller;
}
/**********************************************************************/
public static void main(Args _args)
{
    CustController controller = new CustController();
    controller.parmReportName(#ReportName);
    controller.parmArgs(_args);
    controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
    controller.parmShowDialog(false);
    controller.startOperation();
 }
/****************************************************/
public boolean showQueryValues(str parameterName)
{
    return true;
}
/*****************************************************/
public void setRange(Args _args, Query _query)
{
    QueryBuildDataSource qbds;
    QueryBuildRange qbr;
    if (_args && _args.dataset())
    {
        switch(_args.dataset())
        {
            case tableNum(CustTable) :
                CustTable = _args.record();
                break;
        }
    }
    qbds = _query.dataSourceTable(tableNum(CustTable));
    qbds.clearRanges();
    qbr = qbds.findRange(fieldName2id(tableNum(CustTable),fieldStr(CustTable, AccountNum)));
    if (!qbr)
    {
        qbr = qbds.addRange(fieldNum(CustTable, AccountNum));
    }
    if(CustTable)
    {
        qbr.value(CustTable.AccountNum);
    }
}
/**********************************************************/
protected void prePromptModifyContract()
{
      super();
}
/************************************************************************/
class CustController extends SrsReportRunController
{
    #define.ReportName('CustReport.PrecisionDesign1')
    SRSRDPCustTableContractClass sRSRDPCustTableContractClass;
    CustTable custTable ;

 }

Contract Class in Dynamic AX

Contract Class
class SRSRDPCustTableContractClass
{
AccountNum accountNum;
}
______________________________________________
Add one more parm method to it as shown below 

[DataMemberAttribute("AccountNum")]
public AccountNum parmAccountNum(AccountNum _accountNum = accountNum)
{
accountNum = _accountNum;
return accountNum;
}

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...