Contact Me

Total Pageviews

Monday 25 August 2014

ReportSection.executeSection() method and Programmable Section of a Report in Axapta

Prints the section in the report.It is the super() method call in the executeSection method that actually prints the section in the report.

As an Example,if you want a Page Break before printing a section in a report override the the ExecuteSection() method of the respective section and write:

public void executeSection()
{
    ;
    element.pagebreak();
    super();

}



We can use programmable sections to add any kind of customized information for example : sum of fields in the report .
To activate a programmable section, activate it explicitly with an element.execute(Number) statement. The Number must be specified in the ControlNumber property for the design section.
For example, I’ve created a programmable section calculating the sum of a column in dynamics ax .
To call this section , I add the method element.execute(1); in the fetch method after calling super() and before returning the result of the fetch
public boolean fetch()
{
;
    queryRun = new SysQueryRun(this.query());

    element.hideShowColumns();
    element.modifyQuery();

    while (queryRun.next())
    {

        projInvoiceJour = queryRun.get(tablenum(ProjInvoiceJour));

        gtInvoicedAmount       += projInvoiceJour.invoiceAmountMST();
        gtWIPInvoicedOnAcct    += projInvoiceJour.WIPInvoicedOnAcc();
        gtInvoicedRevenue      += projInvoiceJour.revenueMST();
        gtCostValue            += projInvoiceJour.CostValue;
        gtGrossMargin          += projInvoiceJour.contributionAmountMST();
    }

    super();

    element.execute(1); //Call the programmable Section 1 of the Report.
    return true;
}

The Programmable section contains 5 string controls with data method property set to 5 display methods each returning the Variables total calculated in fetch() method of the report like :

display AmountMST totalGrossMargin()
{
    return gtGrossMargin;
}   

Refer to the ProjInvoiceJournal report for the same. 

Happy Daxing :)

No comments:

Post a Comment