preloader-matrix

Alfasith

Passing parameter between forms and Create reports using Multi select lookup

1.Create formA like

Note : FormA contains multiple select lookup so it has features of getting the multiple Account Number;
Main class is modified as below in the FormA

public classFormRun extends ObjectRun
{
    SysLookupMultiSelectCtrl msCtrl;
}
/***************************************************/
//in the init method of FormA.
public voidinit()
{
    super();
    // AccountNum – Name of control on which you want a lookup.
   // CustQry – Query to get the lookup data of that required table
    msCtrl = SysLookupMultiSelectCtrl::construct(element, AccountNum, querystr(CustQry));
}
/***************************************************************/
//in the button clicked() in FormA.
void clicked()
{
    // Args class is usually used in Axapta for passing parameters between forms
    Args            args;
    FormRun         formRun;
    container contain;
    str        containstr;
    ;
    args = new args();
    // Our values which we want to pass to FormB
    // If we want pass just simple string we can use ‘parm’ method of ‘Args’ class
    contain = [AccountNum
.valueStr()];
    containstr = con2Str(contain);
    args.parm(containstr);
    // Run FormB
    args.name(formstr(CustomerDetails));
    formRun = classFactory.formRunClass(Args);
    formRun.init();
    formrun.run();
    formrun.wait();
    super();
}
/*******************************************************************/
2.Create FormB as like this

On clicking of the above FormA “Clickhere” that concern AccountNum details will be depicted in grid
//in the FormB Class declaration
public classFormRun extends ObjectRun
{
    container       contain;
    str CompanyId;
}
/*************************************************************************/
/ in the init() of that fornB
public voidinit()
{
    str             tmp;
    ;
    super();
    // Check for passed arguments
    if( element.args() )
    {
        contain = str2con(element.args().parm());
        //Now receive the container multiple value with separater as “;” to replace with “,”
         AccountNumb.text(strReplace(strFmt(“%1”,conPeek(contain,1)),‘;’,‘,’));
    }
}
/**********************************************************/
In the Data source of the FormB drop the CustTable and in the executeQuerry() of that datasource
//This makes the grid to reflect with reference to the StringEdit that we added as the range to the grid.
public voidexecuteQuery()
{
     this.query().dataSourceNo(1).addRange(fieldNum(CustTable,AccountNum)).value(AccountNumb
.valueStr());
    super();
}
/***********************************************************/
3.Onclicking of “Cust report Generator” that concern report will be generated like this.

//here you find the change In the image that is because of the company image.

Share on email
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Leave a Reply

Your email address will not be published.