Telerik,
I read your article on passing parameters, but I'm still somewhat confused. Here are my questions:
1. Do I need to set a variable on the SQL statement and then set the value of the variable in the parameter dialog and in code? Exampe:
When I create the report, using the query editor, I would create:
SELECT CustomerID, CustomerName from Customer
Where CustomerID = @CustomerID (<-- do I need to create this in my select statement?)
When I create the report to display a report with a selected customer, do I need to use the ReportParameters collection as well to set the value of the above CUSTOMERID?
Do I need to create a ReportParameter collection item in order to set that iten's value in code? Example:
I read your article on passing parameters, but I'm still somewhat confused. Here are my questions:
1. Do I need to set a variable on the SQL statement and then set the value of the variable in the parameter dialog and in code? Exampe:
When I create the report, using the query editor, I would create:
SELECT CustomerID, CustomerName from Customer
Where CustomerID = @CustomerID (<-- do I need to create this in my select statement?)
When I create the report to display a report with a selected customer, do I need to use the ReportParameters collection as well to set the value of the above CUSTOMERID?
Do I need to create a ReportParameter collection item in order to set that iten's value in code? Example:
report1.ReportParameters[0].Value = iCustomerID;
report1.Report = report1;
Please advise.
10 Answers, 1 is accepted
0
Hi John,
Please note that our Reporting offering is a standard .NET class with added designer for usability reasons. So you can ignore the suggestion that you're working with a 3rd party product and pass the parameter like you would normally do within a .NET class. You can check this video out that shows you how to handle your exact inquiry.
You can also take a look at the Report parameters help article, the report parameters training tutorial available here, and our online "Product Line Sales Catalog" report that shows the report parameters usage at hand.
Greetings,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Please note that our Reporting offering is a standard .NET class with added designer for usability reasons. So you can ignore the suggestion that you're working with a 3rd party product and pass the parameter like you would normally do within a .NET class. You can check this video out that shows you how to handle your exact inquiry.
You can also take a look at the Report parameters help article, the report parameters training tutorial available here, and our online "Product Line Sales Catalog" report that shows the report parameters usage at hand.
Greetings,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

John
Top achievements
Rank 1
answered on 17 Jul 2008, 05:26 PM
If I want to pass multiple values selected from a list to the parameter value, can I do that?
For example:
SQL = "Select CustomerID, Customer from Customer where CustomerID = 1 or CustomerID = 3 or CustomerID = 6
Where the string: CustomerID = 1 or CustomerID = 3 or CustomerID = 6 is being created dynamically in a loop and then attached, via code, as the value for the @CustomerID that was set in the original SQL Statement
If I can't do this, what can you suggest as a better solution?
Thanks in advance.
For example:
SQL = "Select CustomerID, Customer from Customer where CustomerID = 1 or CustomerID = 3 or CustomerID = 6
Where the string: CustomerID = 1 or CustomerID = 3 or CustomerID = 6 is being created dynamically in a loop and then attached, via code, as the value for the @CustomerID that was set in the original SQL Statement
If I can't do this, what can you suggest as a better solution?
Thanks in advance.
0
Hi John,
Yes, you can accomplish that, since the value of a multivalue parameter is IEnumerable.
Please find attached a sample report demonstrating that idea.
Also, consider using the filtering capabilities of the report instead . You can define filter with the IN operator that will produce the same result.
Hope this information helps.
All the best,
Milen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Yes, you can accomplish that, since the value of a multivalue parameter is IEnumerable.
Please find attached a sample report demonstrating that idea.
Also, consider using the filtering capabilities of the report instead . You can define filter with the IN operator that will produce the same result.
Hope this information helps.
All the best,
Milen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

John
Top achievements
Rank 1
answered on 18 Jul 2008, 04:28 PM
I'm almost there. I'm setting the parameter in the class that is creating the report. I'm assigning the value to the parameter in code, on the form load. But the report is not showing up. Below is the code. Thoughts as to what I'm doing wrong?
string
sCustomerID;
sCustomerID = Request.QueryString[
"CustomerID"];
ReportViewer1.Report =
new reportClass();
(ReportViewer1.Report
as reportClass).sCustomerID = sCustomerID;
// In your example, there is a REFRESHREPORT method on the ReportViewer that does not seem to exist anylonger.
0
Hi John,
If in your scenario you do not use the automatic UI of the report parameters (you are passing the values to the SQL outside of the report) there is no need to use report parameters at all. Just pass the needed values using some public field/property (as you are doing) and then do the trick in the NeedDataSource handler.
In the code snippet you've sent us I do not see anything wrong. Did you debug what is coming from the query string in CustomerID? Are you parsing it correctly into single values before concatenating it in the SQL?
Hope this helps.
Regards,
Milen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
If in your scenario you do not use the automatic UI of the report parameters (you are passing the values to the SQL outside of the report) there is no need to use report parameters at all. Just pass the needed values using some public field/property (as you are doing) and then do the trick in the NeedDataSource handler.
In the code snippet you've sent us I do not see anything wrong. Did you debug what is coming from the query string in CustomerID? Are you parsing it correctly into single values before concatenating it in the SQL?
Hope this helps.
Regards,
Milen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

John
Top achievements
Rank 1
answered on 21 Jul 2008, 04:09 PM
Yes, I've debugged and the value passed is being passed properly. That is, if I take the value and insert it directly into the Query, the report displays the necessary data. If I pass the SAME VALUE via a parameter, using the code snippet above, there is no data displayed, but there are no errors.
Is there some way to refresh? Is there something I should do after I assign the CUSTOMERID value to the parameter in the code above?
Thanks
Is there some way to refresh? Is there something I should do after I assign the CUSTOMERID value to the parameter in the code above?
Thanks
0
Hi John,
Please open a support ticket, zip and attach your working report along with backup of your database and your web application as well. Once we review it, we would be able to provide you with more info and advise you accordingly.
Best wishes,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Please open a support ticket, zip and attach your working report along with backup of your database and your web application as well. Once we review it, we would be able to provide you with more info and advise you accordingly.
Best wishes,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

John
Top achievements
Rank 1
answered on 22 Jul 2008, 04:37 PM
Telerik,
I'm almost there. I have a question regarding setting multiple values for a variable in the SQL statement.
SQL Statement:
SELECT CustomerID, CustomerName from Customer
Where CustomerID = @CustomerID
I want to pass it, say, 4 values selected from a list. Ex:
CustomerID = 5
CustomerID = 7
CustomerID = 8
CustomerID = 9
Question: In the query string that I pass to the SQL Statement above, how do I do it? What should the query string look like?
I've tried all combinations in the string I pass to the FILL method in the report class:
"5 or CustomerID =7 or CustomerID = 8 or CustomerID=9"
"CustomerID=5 or CustomerID = 7 or CustomerID = 8 or CustomerID = 9"
Nothing seems to work.
Thoughts?
I'm almost there. I have a question regarding setting multiple values for a variable in the SQL statement.
SQL Statement:
SELECT CustomerID, CustomerName from Customer
Where CustomerID = @CustomerID
I want to pass it, say, 4 values selected from a list. Ex:
CustomerID = 5
CustomerID = 7
CustomerID = 8
CustomerID = 9
Question: In the query string that I pass to the SQL Statement above, how do I do it? What should the query string look like?
I've tried all combinations in the string I pass to the FILL method in the report class:
"5 or CustomerID =7 or CustomerID = 8 or CustomerID=9"
"CustomerID=5 or CustomerID = 7 or CustomerID = 8 or CustomerID = 9"
Nothing seems to work.
Thoughts?
0
Hello John,
You can use the following syntax:
SELECT CustomerID, CustomerName from Customer
Where CustomerID IN (5, 7, 8, 9)
Hope this helps.
Best wishes,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can use the following syntax:
SELECT CustomerID, CustomerName from Customer
Where CustomerID IN (5, 7, 8, 9)
Hope this helps.
Best wishes,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

John
Top achievements
Rank 1
answered on 23 Jul 2008, 03:47 PM
Telerik,
Actually, what untimately worked, was the following:
Select CustomerID, CustomerName
WHERE (CHARINDEX(CustomerID, @CustomerID) > 0)
Instead of using the IN keyword.
Select CustomerID, CustomerName
WHERE CustmoerID IN (@CustomerID)
Thanks a bunch for sticking with me on this one. I have a happy client as a result.
J
Actually, what untimately worked, was the following:
Select CustomerID, CustomerName
WHERE (CHARINDEX(CustomerID, @CustomerID) > 0)
Instead of using the IN keyword.
Select CustomerID, CustomerName
WHERE CustmoerID IN (@CustomerID)
Thanks a bunch for sticking with me on this one. I have a happy client as a result.
J