Rabu, 08 September 2021

SSRS dengan multiple design

Salah satu cara untuk memanggil multiple design pada SSRS.

Bisa dilakukan custom pada class Controller.
Controller.prePromptModifyContract

disini kita akan membaca lemparan dari mana record berasal.
contoh

protected void prePromptModifyContract()
{
    //add husna 20210907
    RsPcmFoodingPaymentTable                sectiontable;
    PSMSumEXFoodingHeader                   depttable;

    if (!contract)
    {
        contract = this.parmReportContract().parmRdpContract() as RS_HR_ExtraFoodingPaymReportContract;
    }

    //membaca lemparan parameter
    if(this.parmArgs().dataset() == tableNum("PSMSumEXFoodingHeader"))
    {
        depttable = this.parmArgs().record();
        contract.parmJournalIdDept(depttable.JournalId);
    }
    if(this.parmArgs().dataset() == tableNum("RsPcmFoodingPaymentTable"))
    {
        sectiontable = this.parmArgs().record();
        contract.parmJournalId(sectiontable.JournalId);
    }



    //contract.parmJournalId(data.JournalId); remark by husna 20210907

    super();
}

di Main method
public static void main(Args _args)
{
    RS_HR_ExtraFoodingPaymReportController  controller = new RS_HR_ExtraFoodingPaymReportController();
    SRSPrintDestinationSettings printSettings;
    ;

    if(_args.dataset() == tableNum("PSMSumEXFoodingHeader"))
    {
        controller.parmReportName(ssrsReportStr(RS_HR_ExtraFoodingPaymReport, DesignDept));
        controller.parmArgs(_args);
        printSettings = controller.parmReportContract().parmPrintSettings();
    }
    if(_args.dataset() == tableNum("RsPcmFoodingPaymentTable"))
    {
        controller.parmReportName(ssrsReportStr(RS_HR_ExtraFoodingPaymReport, Design));
        controller.parmArgs(_args);
        printSettings = controller.parmReportContract().parmPrintSettings();
    }

    //printSettings.printLandscape(true);
    controller.parmShowDialog(false);
    controller.startOperation();
}

//preRunModifyContract x++ AX2012

Erorr CS1963 - An expression tree may not contain a dynamic operation.

Kali ini saya mendapatkan erorr dengan code CS1963, padahal sebelumnya saya sudah mendefinisikan 'var item in Model' di @foreach(var...