Monday, March 30, 2020

SSRS with ID filter Dynamics 365

Create a temporary table,in this case "CustReportTmp"
set table type property to "InMemory"
add the fields that you want to add in the report from the table you want to add
Now create a new RDP class,Best practice to suffix the rdp class name with DP
Now write the following code:

class CustReportFilterDP extends SRSReportDataProviderBase
    CustReportTmp   custReportTmp;
    TTC_CustID        ID;

    public custReportTmp getCustReportRDPDemoTmp()
        select * from custReportTmp;
        return custReportTmp;

    public void processReport()
        CustReportFilterContract    contract;
        TTC_Customer                customer;

        contract    = this.parmDataContract() as CustReportFilterContract;
        ID             = contract.parmID();

        while select * from customer where customer.ID  ==  ID
            custReportTmp.ID              =   customer.ID;
            custReportTmp.Name        =   customer.Name;
            custReportTmp.Age           =   customer.Age;
            custReportTmp.Phone        =   customer.Phone;
            custReportTmp.EmailID     =   customer.EmailID;
            custReportTmp.Balance     =   customer.Balance;


now add a contract class

class CustReportFilterContract
    TTC_CustID ID;

    public TTC_CustID parmID(str _ID = ID)
        ID  =   _ID;
        return ID;


now right click on project -> add -> new item ->
than select "Report"
rename the report accordingly,in this case "ReportFilterRDP"
right click on dataset and add a dataset,name it accordingly
now go to properties of the dataset created
and put data source type to "Report Data Provider"
and select the query that we created (in this case we will select the class that we created)
now right click on design and create a new design
go to properties and give the name of the design and style template to "table style alternating rows"
now right click on design and click on "edit using designer"
now add a table from the ToolBox and and add the necessary fields that you want to add in the report
or you can make the report as per your requirements
now from the solution explorer right click on your report and click deploy report
now right click on project area and rebuild your project
add an output menu item for your report and place it in "Menu Extension" as per your requirement