February 11, 2013

How to pass values between form and report

How to pass values between form and report

Here is for example the code of the button that calls the report:

void clicked ()
{
    Args     args;
    ReportRun          reportRun;
    ;
    super();
    args = new Args();
    args.name(Reportstr(HistoryHolidays));
    args.parm( LogId  );
    reportRun = classfactory.reportRunClass(args);
    reportRun.init();
    reportRun.run();
    reportRun.wait();
    args.parmObject( args );
}

in the init method of your report try this:

public void init()
{
    if( element.args() )
    {
        logId =  element.args().parm();
    }
     super();
}

then you can use this parameter in your report form example: 

public void executeSection()
{
    ;
    if  ( employee_1.LogId == logId)
    {
        emplId = employee_1.empId;
        super();
    }
    if ( logid == "1")
    {
        emplId = DropHoliday_1.EmpId;
        super();
    }
}

You can use this logic in your code for many purpose.

-Harry
 

No comments:

Post a Comment

Thanks