How to pass report name in SSRS report DP class

Hello, friends

I need to pass report name to my DP class as based on specific report chosen one of the varaibles in DP class is changing. I have tried to pass the parameter through contract class, but when I call it in DP class null reference error is returned. From the info strings I have tried to pass it seems that SrsReportDataContract contract = this.parmDataContract(); method is not passing any contract in DP class. When I try to pass str test = this.parmDataContract().parmReportCaption(); the error says that the contract class does not have such method. Method parmReportCaption is the standard method of SrsReportDataContract class. It would be nice if you could help me in this.

DP class method processReport:

public void processReport()
    {
        Query           query    = this.parmQuery();
        QueryRun        queryRun = new QueryRun(query);
        Common          cursor;
        //<GEERU>
        CompanyInfo companyInfo;
        //</GEERU>
        
        //throw error(strFmt("processReport() is %1"));
        
        SrsReportDataContract contract = this.parmDataContract();
        str test = this.parmDataContract().parmReportCaption();



        throw error(strFmt("processReport() is %1"));
        //str test = contract.parmReportCaption();
        throw error(strFmt("processReport() 2 is %1", contract.parmReportCaption()));
        switch(contract.parmReportCaption())
        {
            
            case "EBRetailLabel.A4_Shelf_68x39":
                maxcolumn = 3;
				break;
            case "EBRetailLabel.A4_Shelf_90x70_Discount":
                maxcolumn = 2;
				break;
            case "EBRetailLabel.A4_Shelf_210x148_Discount":
                maxcolumn = 1;
				break;
            case "EBRetailLabel.A4_Shelf_210x148":
                maxcolumn = 1;
                break;
            case "EBRetailLabel.A4_Shelf_72x53":
                maxcolumn = 2;
                break;
            case "EBRetailLabel.A4_Shelf_41x39":
                maxcolumn = 5;
                break;
            case "EBRetailLabel.A4_Shelf_90x70":
                maxcolumn = 2;
                break;
        }

Controller class main method:

public static void Main(Args _args)
{
RetailLabelControllerEBSkyBaltia_Ext controller = new RetailLabelControllerEBSkyBaltia_Ext();
SrsReportDataContract dataContract;
SRSPrintDestinationSettings printSettings;

controller.parmArgs(_args);
//throw error(strFmt("controller.parmArgs(_args);"));
dataContract = controller.parmReportContract();
if (dataContract)
{
printSettings = dataContract.parmPrintSettings();
if (printSettings)
{
// Download the report in pdf format.
printSettings.printMediumType(SRSPrintMediumType::File);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.fileName(controller.parmReportName() + '.pdf');
}
}

//throw error(strFmt("parmReportName() is %1", controller.parmReportName()));
//EBRetailLabelContract contract;
//EBRetailLabelContract contract = contract as EBRetailLabelContract;
//contract = controller.getDataContractObject() as EBRetailLabelContract;
str reportname = controller.parmReportName();

dataContract.parmReportCaption(reportname);

//str getreportname = dataContract.parmReportCaption();///  This line of code gets passed parameter, i checked
//throw error(strFmt("parmReportName() is %1", getreportname));  ///  This line of code gets passed parameter, i checked
controller.startOperation();
}

Maybe there is more simple way to pass report name in DP class?

Best regards,

Roberts

Related
Recommended