web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

SSRS report error - Parameter doesn't ca

Posted on by 618

Hi Experts,

I have created a custom SSRS report which needs to be printed from a form i.e.. the argument should pass to the report from the form. The report does not work and gives me the error while trying to generate, A value must be provided for the parameter Load Id. I will provide my code here, can anyone help me to find out if i missed something or what is the issue with the code please. Load id is my parameter for the report. 

Contract class:- 

[DataContractAttribute]

public class SalesLoadPackingSlipContract

{

    WHSLoadId   LoadId;

    

    [

        DataMemberAttribute('Load Id'),

        SysOperationLabelAttribute(literalStr(/Load Id/)),

        SysOperationControlVisibilityAttribute(true)

    ]

    

    public WHSLoadId parmLoadId(WHSLoadId _LoadId = LoadId)

    {

        LoadId = _LoadId;

        return  LoadId;

    }

}

 

Controller class:- 

class SalesLoadPackingSlipController extends SrsReportRunController
{       
    public static void main(Args _args)
    {
        SalesLoadPackingSlipController    controller = new SalesLoadPackingSlipController();
        WHSLoadTable wHSLoadTable;
        wHSLoadTable = _args.record() as wHSLoadTable;
        controller.parmArgs(_args);
        controller.parmReportName(ssrsReportStr(SLoadPackingSlip, Common));
        controller.parmShowDialog(false);
        controller.startOperation();
    }
}
 
DP Class:-
 
[SRSReportParameterAttribute(classStr(SalesLoadPackingSlipContract))]
class SalesLoadPackingSlipDP extends SRSReportDataProviderBase  //SrsReportDataProviderPreProcess //
{
    //contract Class
    SalesLoadPackingSlipContract  salesLoadPackingSlipContract;
    //Temporary Tables to get report Data
    LoadPackingSlipHeaderTmp   loadPackingSlipHeaderTmp;
    LoadPackingSlipLineTmp     loadPackingSlipLineTmp;
 
    //Data Tables
    CompanyInfo            companyInfo;
    CustPackingSlipJour    custPackingSlipJour;
    CustPackingSlipTrans   custPackingSlipTrans;
    WHSLoadTableCustPackingSlipJour wHSLoadTableCustPackingSlipJour;
    
    //Report Parameter value
    WHSLoadId       LoadId;
    [SRSReportDataSetAttribute(tablestr(LoadPackingSlipHeaderTmp))]
    public LoadPackingSlipHeaderTmp getLoadPackingSlipHeaderTmp()
    {
        select loadPackingSlipHeaderTmp;
        return loadPackingSlipHeaderTmp;
    }
    [SRSReportDataSetAttribute(tablestr(LoadPackingSlipLineTmp))]
    public LoadPackingSlipLineTmp getLoadPackingSlipLineTmp()
    {
        select loadPackingSlipLineTmp;
        return loadPackingSlipLineTmp;
    }
    private void getReportParameters()
    {
        salesLoadPackingSlipContract contract = this.parmDataContract();
        if (contract)
        {
            LoadId   = contract.parmLoadId();
        }
    }
    [SysEntryPointAttribute(false)]
    public void processReport()
    {
        //to fetch report parameters
        this.getReportParameters();
        companyInfo = CompanyInfo::find();
        CustTable       CustTable;
        WHSLoadLine     whsLoadLine;
        salesLoadPackingSlipContract = this.parmDataContract() as salesLoadPackingSlipContract;
        if(LoadId)
        {
            loadPackingSlipHeaderTmp.LoadId = LoadId;  // Added just one line for testing purpose
            loadPackingSlipHeaderTmp.insert();
        }
    }
}

 

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Willem van Duren Profile Picture

Willem van Duren 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans