This is a migrated thread and some comments may be shown as answers.

how to pass multivalue parameter from jQuery.fn.telerik_ReportViewer reportSource?

7 Answers 397 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
tiffany
Top achievements
Rank 1
tiffany asked on 09 Feb 2014, 11:00 PM
I have a report with a multivalue parameter. It works fine in preview. But I tried to pass selections from my own multi-select combo box (selection is string type) from jQuery.fn.telerik_ReportViewer, it doesn't work, see below. What's the correct syntax ?

$("#reportViewer1")
                  .telerik_ReportViewer({
                      serviceUrl: "api/Reports/",
                      templateUrl: 'ReportViewer/templates/telerikReportViewerTemplate.html',
                      reportSource: {
                          report: "ReportLibrary.test, ReportLibrary",
                          parameters: {                               
                              para1: " 'test1', 'test2'"                     
                               }
                      },
                      viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
                      scaleMode: telerikReportViewer.ScaleModes.FIT_PAGE_WIDTH,
                      scale: 1.0,
                      ready: function () {
                          //this.refreshReport();
                      }
                  })

















































7 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 12 Feb 2014, 05:05 PM
Hello,

I believe you already discussed this issue with my colleague in your support thread on the same question. Here is a quote for anyone concerned:

"Passing multiple values to a parameter is achieved through an object array. Consider the following sample:
<script type="text/javascript">
    $(document).ready(function () {
        $("#reportViewer1")
            .telerik_ReportViewer({
                serviceUrl: "api/reports/",
                templateUrl: 'ReportViewer/templates/telerikReportViewerTemplate.html',
                reportSource: {
                    report: "Telerik.Reporting.Examples.CSharp.ReportCatalog, CSharp.ReportLibrary",
                    parameters: { MultivalueParam: ["ER Prelim Report", "Minor ERD"] }
                },
                viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
                scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
                scale: 1.0,
                ready: function () {
                    //this.refreshReport();
                },
            });
    });
</script>
"


Regards,
Stef
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

0
Bryant
Top achievements
Rank 1
answered on 10 Mar 2014, 04:20 PM
How do you add this using the Html extension helpers?

@{
        var report = new UriReportSource() { Uri = "TransactionTotals.trdx" };
        report.Parameters.Add( "AccountNumber", baseController.CurrentAccount.AccountId );
        report.Parameters.Add( "StartDate", DateTime.Now.AddDays( -30 ) );
        report.Parameters.Add( "EndDate", DateTime.Now );
        report.Parameters.Add(); // multi value param?
    }
0
Nasko
Telerik team
answered on 13 Mar 2014, 05:14 PM
Hello Bryant,

You can still use an object array in the HTML extension helpers:
report.Parameters.Add( "MultiValueParameter", new object[] { "Value1", "Value2" });

Regards,
Nasko
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Kyle
Top achievements
Rank 1
answered on 20 Jul 2016, 07:17 PM

I'm getting an error:

Failed to convert parameter value from a Object[] to a IEnumerable`1.
------------- InnerException -------------
Object must implement IConvertible

When I pass a multi value parameter as specified above. The parameter is supposed to be fed to a Sql data source as a Table type with one column of ints. Is this the wrong way to do this?

0
Stef
Telerik team
answered on 21 Jul 2016, 09:24 AM
Hi Kyle,

If you are using a SQL stored procedure and you need to pass a multivalue treport parameter, the multi-value report parameter is evaluated as an array of objects that cannot be passed directly. Table-valued SQL parameters are not supported.

An example and possible settings in the stored procedure are illustrated in the How to use MultiValue Report Parameter in a SQL query KB article.



I hope this helps.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kyle
Top achievements
Rank 1
answered on 21 Jul 2016, 12:49 PM
I ended up just using an object data source and converting the parameters to the specified table type before executing the query and returning a DataTable. It's not awful doing it this way but I wish the report designer supported all of the necessary types including user-defined types. It would also be a huge help if we were allowed to specify object data source members without the DLL being accessible, as the report viewer often has trouble detecting the DLLs even when set up in the config.
0
Stef
Telerik team
answered on 25 Jul 2016, 01:23 PM
Hello Kyle,

Values that can be submitted to data retrieval methods are of the types supported by report parameters.Custom types are not supported, which includes user-defined types and Table-valued variables for SQL queries which are specific per .NET data provider, and SQL database respectively.

Thus the used workaround is also recommended by us - create a custom data access layer that casts and creates arguments, and executes the required methods.


About using custom data access layers in the Standalone Report Designer, the assembly can be loaded from the folder or sub folder of the Standalone Report Designer - Extending Report Designer. The same settings must be applied to applications displaying the produced reports - Previewing a report definition that uses an external assembly.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
tiffany
Top achievements
Rank 1
Answers by
Stef
Telerik team
Bryant
Top achievements
Rank 1
Nasko
Telerik team
Kyle
Top achievements
Rank 1
Share this question
or