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
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

How to create a report with parameters?

He was looking at the documentation, but as I see this being done in the .rdlc file (in the driver there is nothing, and the same view).

I added the parameters as shown in the following images.






This gives me the following error




My controller
public class ReportController : Controller
    {
        private InterventoriasEntities db = new InterventoriasEntities();

        // GET: Report
        public ActionResult MemoriasDeCalculo()
        {
           
                var proyec = (Entities.Proyecto)Session["proyecto"];
                ViewData["MemoriasCalculos"] = db.sp_memoriasDeCalculoCantidades(proyec.idProyecto).ToList();
                ViewData["InfoProyecto"] = db.sp_infoProyecto(proyec.idProyecto).ToList();
                return View();
           
          
        }
    }


My view
....

                                @(Html.EJ().ReportViewer("reportviewer")
.ProcessingMode(Syncfusion.JavaScript.ReportViewerEnums.ProcessingMode.Local).ReportPath("~/Reports/MemoriasDeCalculoCantidades.rdlc")
.ReportServiceUrl(VirtualPathUtility.ToAbsolute("~/api/ReportApi")).ReportLoaded("onReportLoaded").DataSources(ds => { ds.Name("DataSetMemoriasCalculos").Value(ViewData["MemoriasCalculos"]).Add(); ds.Name("DataSetInfoProyecto").Value(ViewData["InfoProyecto"]).Add(); }))

.....

Is there any example where this report rdlc to guide me? or a solution?

5 Replies

YD Yuvaraj Devarajan Syncfusion Team September 28, 2016 11:40 AM UTC

Hi Norberto, 
 
Thanks for contacting Syncfusion support. 
 
We were unable to reproduce the mentioned issue at our end. The mentioned issue might occur if the given dataset field name in the report parameter available value is not present in the datasource. So please ensure whether the given dataset field is present in datasource. We have prepared the sample with RDLC Report Parameter and it can be downloaded from,   
 
If the issue still persists, then share the issue reproducible RDLC file with local data to validate the mentioned issue at our end.   
 
Regards, 
Yuvaraj D. 



NO Norberto September 28, 2016 02:25 PM UTC

Hello Yuvaraj D.
Thanks for answering.

He was looking at the example, and as I see your .rdlc file, you have a query parameter where there also and I imagine there get data for the report.
<DataSets>
    <DataSet Name="StoreSales">
      <Query>
        <DataSourceName>AdventureWorks2008R2</DataSourceName>
        <QueryParameters>
          <QueryParameter Name="@StateProvinceCode">
            <Value>=Parameters!StateProvinceCode.Value</Value>
          </QueryParameter>
        </QueryParameters>
        <CommandText>SELECT soh.SalesOrderID, soh.TotalDue, soh.OrderDate, c.CustomerID,
   st.Name AS Store,
..................


In my case, I get the data from a stored procedure, I have it in a dataset.
<DataSets>
    <DataSet Name="DataSetMemoriasCalculos">
      <Query>
        <DataSourceName>InterventoriasDataSet</DataSourceName>
        <CommandText>/* Local Query */</CommandText>
      </Query>


I thought I could do a global query, and from this, make a filter with parameters


YD Yuvaraj Devarajan Syncfusion Team September 29, 2016 12:58 PM UTC

Hi Norberto, 

In RDLC Report, we cannot use query parameter to filter the data values from datasource. But we can filter the data from datasource using parameter in dataregion. We have shared the converted RDL file into RDLC report in previous update. Hence the Query parameter are present in RDLC and we won’t process the query parameter for filtering the datasource value.  

In RDL report, we can use query parameter to filter the value from datasource. We have modified the shared sample using RDL query parameter and it can be downloaded from,  

If we have misunderstood your requirement, then share much more information about your scenario to validate the issue. 

Regards, 
Yuvaraj D. 



NO Norberto September 29, 2016 03:43 PM UTC

Hello Yuvaraj D.
First, sorry for not express myself well, I'm using google translator. LOL
I try to explain very well.

For the generation of my reports, I am using a DataSet, where TablaAdapter added through stored procedures. Then I believe my report and select the DataSet and TableAdapter that previously believed.

And the report is displayed correctly.

Now, I want you to report that displays, adding a "filter". The TableAdapter brings me NEXT information.


For example, I want the report has a filter by "idSubCapitulo". Where out a list of data that has that field my TableAdapter and can select the item and view the report.

Enclosed is my report RLCD

Thank you very much.

Attachment: MemoriasDeCalculoCantidades_dadfc3d7.zip


YD Yuvaraj Devarajan Syncfusion Team September 30, 2016 12:51 PM UTC

Hi Norberto, 

We can set/pass the parameter value from viewer to WebAPI in order to filter the data from datasource for RDLC Report using doAjaxPost method in control render viewer page as shown in following shared code example, 
<script type="text/javascript"> 
    var _params = null; 
    ej.ReportViewer.prototype._viewReportParamsClick = function (event) { 
        var proxy = $('#reportsample').data('ejReportViewer'); 
        var parameters = event.data.params; 
        var reportParams = proxy._getParameterJson(parameters); 
        proxy._refresh = true; 
        $('#' + proxy._id + '_viewBlockContainer .e-reportviewer-viewerblockcontent table:first').attr('isviewclick', 'true'); 
        _params = reportParams;        
        proxy._refreshReport(); 
    } 
 
    ej.ReportViewer.prototype.doAjaxPost = function (type, url, jsondata, onSuccess) { 
        var proxy = $('#reportsample').data('ejReportViewer'); 
        var inVokemethod = onSuccess; 
 
        $.ajax({ 
            type: type, 
            url: url, 
            crossDomain: true, 
            contentType: 'application/json; charset=utf-8', 
            dataType: 'json', 
            data: jsondata, 
            beforeSend: function (req) { 
                if (inVokemethod == "_getDataSourceCredential") { 
                    var _json = jQuery.parseJSON(this.data); 
                    if (_params != null) { 
                        _json["params"] = _params; 
                    } 
                    this.data = JSON.stringify(_json); 
                } 
 
                if (inVokemethod == "_getPageModel" || inVokemethod == "_getPreviewModel") { 
                    if (!proxy._isToolbarClick) { 
                        proxy._showloadingIndicator(true); 
                        proxy._updateDatasource = true; 
                    } else { 
                        proxy._showNavigationIndicator(true); 
                    } 
                } 
                req.setRequestHeader('ejAuthenticationToken', proxy._authenticationToken); 
            }, 
            success: function (data) { 
                if (data && typeof (data.Data) != "undefined") { 
                    data = data.Data; 
                } 
                if (typeof (data) == "string") { 
                    if (data.indexOf("Sf_Exception") != -1) { 
                        proxy._renderExcpetion(inVokemethod + ":" + data); 
                        return; 
                    } 
                } 
                proxy[inVokemethod](data); 
            }, 
        }); 
    } 
 
</script> 

We have prepared the sample with Report Parameter used in RDLC Report and it can be downloaded from, 

So please confirm whether the above solution is same as reported scenario. If the scenario is different than share much more information to provide solution for your requirement at earliest.  

Regards, 
Yuvaraj D. 


Loader.
Live Chat Icon For mobile
Up arrow icon