We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Need to add Report parameters to my report for filtering the data

Hi, I am working on integration of ReportViewer using angularjs module. After a lot of struggle i made it working with my code. But now i want to integrate filter parameters in the report using report parameters so that i could filter the report. I tried adding parameters in client end as well as in web api. Please let me know the solution for the same. I have attached a screenshot what i want in my report.

Attachment: Capture_52d5aaaf.zip

1 Reply

YD Yuvaraj Devarajan Syncfusion Team June 2, 2016 11:31 AM UTC

Hi Hougth, 
 
Thanks for contacting Syncfusion support. 
 
We can set the parameter values to report through ReportViewerOptions in WebAPI side. The ReportViewer has parameter property that is the list of report parameter type to add collection of report parameter to it in server side (WebAPI) and also in client side (JS) as shown in below code example.   

WebApi: 
public void OnInitReportOptions(ReportViewerOptions reportOption) 
        { 
            List<ReportParameter> parameters = new List<ReportParameter>(); 
            parameters.Add(new ReportParameter() { Name = "SalesYearParameter", Labels = new List<string>() { "2003" }, Values = new List<string>() { "2003" } }); 
            reportOption.ReportModel.Parameters = parameters; 
 
        } 
 
JS: 
<script type="text/javascript"> 
        angular.module('syncApp', ['ejangular']).controller('ReportController', function ($scope) { 
            $scope.report = true; 
            $scope.samplevalue = 'http://' + window.location.host + '/api/ReportApi'; 
            $scope.path = '~/Report/Sales Dashboard.rdl'; 
            $scope.mode = ej.ReportViewer.ProcessingMode.Remote; 
            $scope.parameters = [{ 
                name: 'SalesYearParameter', 
                labels: ['2003'], 
                values: [2003] 
            }] 
        });         
        
    </script> 
 
We have prepared the sample and it can be downloaded from below location, 

Please refer the below UG documentation for more information, 

Regards, 
Yuvaraj D 


Loader.
Live Chat Icon For mobile
Up arrow icon