SSRS renderingCompleted delegate

Comment from: \Classes\SrsReportRunController\renderingCompleted
/// Write event handlers and hook into this to handle the rendering complete event.
/// IMPORTANT NOTE: Please ensure you register your event handler in <c>preRunModifyContract</c> method.
/// This will ensure that event is called in both batch and interactive scenario.
/// For interactive cases controller <c>main</c> method is called. For batch case controller <c>run</c> method is called.
/// Both batch and interactive call <c>preRunModifyContract</c> prior to running report.
/// If using <c>SrsPrintMgmtController</c> you can also register this event in <c>runPrintMgmt</c> method.

Subscription: \Classes\CustInterestNoteFormLetterController\main
    SrsReportRunController reportRunController = new CustInterestNoteFormLetterController();

    reportRunController.parmReportName(PrintMgmtDocType::construct(PrintMgmtDocumentType::CustInterestNote).getDefaultReportFormat());
    reportRunController.parmArgs(_args);
    reportRunController.renderingCompleted += eventhandler(CustInterestNoteFormLetterController::renderingComplete);
    reportRunController.startOperation();

Standard example: \Classes\CustInterestNoteFormLetterController\renderingComplete
public static void renderingComplete(SrsReportRunController _sender, SrsRenderingCompletedEventArgs _eventArgs)
{
    CustInterestJour custInterestJour;
    InterestNote interestNote;
    Query query;
    QueryRun queryRun;
    FormRun formRun;
    SRSReportExecutionInfo executionInfo = _eventArgs.parmReportExecutionInfo();

    if(executionInfo && executionInfo.parmIsSuccessful())
    {
        // Get the report's query
        query = _sender.parmReportContract().parmQueryContracts().lookup(_sender.getFirstQueryContractKey());

        // Mark all interest notes "Printed"
        queryRun = new QueryRun(query);
        ttsbegin;
        while(queryRun.next())
        {
            interestNote = queryRun.get(tableNum(CustInterestJour)).(fieldNum(CustInterestJour, InterestNote));
            update_recordset custInterestJour
                setting Printed = NoYes::Yes
                where custInterestJour.InterestNote == interestNote && !custInterestJour.Printed;
        }
        ttscommit;

        // Refresh the grid
        formRun = _sender.parmArgs().caller()
            // <GEEPL>
            as FormRun
            // </GEEPL>
            ;

        if(FormRun)
        {
            formRun.dataSource(1).research(true);
        }
    }
}

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags