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

Passing Report Parameters from Report Viewer

2 Answers 90 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 2
Shawn asked on 14 Aug 2014, 04:12 PM
I have a stand-alone HTML page based on the Report Viewer samples. This page calls the api/reports API. When my report is not parameterized, the Report Viewer works great and my report appears. I am now trying to add parameters to my report. 

Here is my Report Viewer script that passes the parameter:
$("#reportViewer1")
            .telerik_ReportViewer({
                serviceUrl: "http://localhost:36563/api/reports/",
                templateUrl: '/ReportViewer/templates/telerikReportViewerTemplate-8.1.14.804.html',
                reportSource: {
                    report: "MembersTest.trdx",
                    parameters: {
                        LastName: 'McGuy'
                    }
                }
            });

Here is the parameter JSON being passed into '/api/reports/clients/085707-b6ce/parameters':
[{"name":"LastName","type":"System.String","text":"Last Name","multivalue":false,"allowNull":false,"allowBlank":true,"isVisible":false,"autoRefresh":false,"hasChildParameters":false,"childParameters":null,"availableValues":null,"value":"McGuy","id":"LastName","label":"McGuy"}]

So it appears to be passing the parameter. In fact, I added a text box that prints the LastName parameter, and when the report loads, it shows "McGuy", which is the value I am passing. But the report does not return any rows. Here is my report SQL:

SELECT
Last_Name, First_Name, Middle_Name, Birth_Date
FROM
Member
WHERE
(Last_Name = @LastName)

When I go through the "Configure SQL Data Source" dialogues in the stand alone Report Builder, it returns records based on my parameter, when I preview.

I am not sure what I am doing wrong. Any help would be great.









2 Answers, 1 is accepted

Sort by
0
Accepted
Nasko
Telerik team
answered on 18 Aug 2014, 05:08 AM
Hello Shawn,

Make sure that the report parameter is connected properly to the SQL Data Source parameter placeholder. For more information, please refer to the Using Parameters with the SqlDataSource component help article.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Shawn
Top achievements
Rank 2
answered on 18 Aug 2014, 05:52 PM
Yep, looks like that was it. Somehow the DataSource got disconnected from the report. Thanks!
Tags
General Discussions
Asked by
Shawn
Top achievements
Rank 2
Answers by
Nasko
Telerik team
Shawn
Top achievements
Rank 2
Share this question
or