Tuesday 24 September 2013

Report to display current record in the Form On button click in ax 2009


·         In click method (First Method)
void clicked()
{
    Args                    args;
    ReportRun               reportRun;
;
    super();

    args = new Args();
    args.name(reportStr(NSGEmplVacations));

    reportRun = new ReportRun(args);
    reportrun.report().interactive(false);
    reportrun.query().interactive(false);
                                                                SysQuery::findOrCreateRange(reportrun.query().dataSourceTable(tablenum(EmplTable)),
                  fieldnum(EmplTable, EmplId)).value(Vacations.EmplId);
    reportRun.init();
    reportRun.run();
}
·         In the click method(Second Method)
1.       void clicked()
{
    Args        args;
    ReportRun   reportRun;
    NASVacationTransId      _VacationTransId;
      ;
    args = new args();
    args.name(reportstr(NSG_VacationRequestReport));
    args.record(Vacations);
    args.parm(Vacations.NASVacationTransId);
    reportRun = classFactory.reportRunClass(args);
    reportRun.init();
    reportRun.run();
}

2.       public boolean fetch()
{
    boolean ret;

this.query().dataSourceTable(TableNum(Vacations)).addRange(FieldNum(Vacations,    NASVacationTransId)).value(_VacationTransID);
    ret = super();

    return ret;
}

3.       public void init()
{
    _VacationTransID    = element.args().parm();
    _vacTable           = element.args().record();
    super();

}

No comments:

Post a Comment