Sunday, May 8, 2011

Passing the parameters from the Form to Report..

http://dynamicsuser.net/forums/t/42147.aspx

In Button clicked method()
void clicked()
{
    Args        args = new args();
    ReportRun   reportRun;
    ;
    args.parm(emplTable.EmplId);
    args.name(reportstr(report2)); // report2 - ReportName
    reportRun = classFactory.reportRunClass(args);
    reportRun.init();
    reportrun.run();
    super();
}

In the report init method
public void init()
{
    ;
    try
    {
        if(element.args().parm())
        {
            this.query().dataSourceTable(tablenum(EmplTable)).addRange(fieldnum(EmplTable,EmplId)).value(element.args().parm());
            this.query().userUpdate(false);
            this.query().interactive(false);
            super();
        }
    }
    catch(exception::Error)
    {
        info("Error");
    }
}

1 comment: