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

Adding parameters via Wizard and Designer

1 Answer 102 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kelvin
Top achievements
Rank 1
Kelvin asked on 12 Oct 2012, 07:57 PM
Hi,

This is my first foray into the Telerik Reports so please excuse my lack of knowledge.  I am attempting to develop a report where the user can enter a start date and an end date.  I am connecting to a SQL 2008 Data Source and running SQL similar to this:

SELECT     COUNT(*) AS ProductCount, ProductDescription, StateCode
FROM         ProductSales
WHERE     (SaleDate > @StartDate) AND (SaleDate <= @EndDate)
GROUP BY  ProductDescription, StateCode
ORDER BY StateCode, ProductDescription 

When I step through the designer wizard I can connect to the data source without a problem, can add the sql without a problem, define the parameters without an issue, can set the parameters and view the results of the SQL and finish/create the report.

So I have a report with the above SQL contained in it.  OK...now I need to set the parameters so I go into the designer, select the report and edit the properties.  In the ReportParameters it has No ReportParameters so I go and add 2...

Name: StartDate 
AllowBlank = false
Visible = true
Type = DateTime

Name: EndDate 
AllowBlank = false
Visible = true
Type = DateTime

Then I save the file and build the project.  All goes well and when I preview the report indeed the StartDate and EndDate inputs are there.  I select the same (or any other) dates that I chose when I ran the wizard above and click the preview button.  The report is generated but no data is returned.  It is like the report totally ignores the parameters.  

If I code into the SQL the dates the report works fine.  I think I am doing something wrong with the parameters in the SQL...there they are @StartDate etc. and in the parameters editor I enter StartDate (can't enter the @StartDate as it is invalid).

In a nutshell I can see the data in the wizard or if I hard code the dates but once I get to the designer I cannot see them.  Any thoughts on what I am missing?  Your assistance is appreciated!

Thanks in advance,

Kelvin






                      

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 16 Oct 2012, 11:15 AM
Hi Kelvin,

Thank you for your interest in Telerik Reporting and your thorough description of the problem. In order to create a link between your SqlDataSourceParameter and the Report Parameters, you should set the Value for the datasource parameter to be the report parameter value. For more information check the following articles:

Kind regards,
Steve
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Tags
General Discussions
Asked by
Kelvin
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or