userscore.detcol3.Value = "=average"; |
userscore.detcol3.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right; |
userscore.detcol3.Width *= .75; |
userscore.detcol3.Style.BackgroundColor = Color.Teal; |
userscore.detcol3.Location.X.Add(new Unit(1.0, UnitType.Inch)); |
I want to create a report that just shows the top 5 records for use in a dashboard. (I'll link to another page with the full results.) I want the number top number (5 inthis case) to be configurable, so I created a report parameter, RecLimit, which is an Integer with a default value of =5. To limit the records I created a filter on the report and used the Top N operator, so my filter looks like this:
Expression: =RowNumber()
Operator: Top N
Value: =Parameters.RecLimit
When I preview the report, one of two things happens. If the report parameter UI.Visible property is set to True then I get the error "Filter cannot be evaluated. Value should evaluate to Integer." If the visibility is set to False then the report displays with all the records. The Top N filter is ignored.
If I run in debug I see this stack trace:
System.InvalidOperationException: Filter cannot be evaluated. Value should evaluate to Integer.
at Telerik.Reporting.Processing.Data.TopBottomFilterOperator.Create(IEnumerable`1 filters, Object context)
at Telerik.Reporting.Processing.Data.RuntimeDataSource..ctor(Object dataSource, String dataMember, IEnumerable`1 filters, IEnumerable`1 sorting, Object expressionContext, String name)
at Telerik.Reporting.Processing.Data.RuntimeDataSource..ctor(IDataSource dataSrc, Object expressionContext)
at Telerik.Reporting.Processing.ReportDataSource..ctor(IDataSource1D dataSource, Boolean detailGroup, Object expressionContext)
at Telerik.Reporting.Processing.Report.ProcessItem()
at Telerik.Reporting.Processing.ReportItemBase.Process(DataMember data)
Doesn't RowNumber() return an Integer?
What am I doing wrong here?
I created the report with Reporting Q2 2009 (version 3.1.9.807).
I have a web page (page1) that calls another page including the ReportViewer control. Page1 includes a button that when clicked redirects to the ReportViewer page. The call redirection from Page1 to the ReportViewer page includes 2 parameters in the QueryString. One parameter tells the ReportViewer which report to display from my report lib class. The other parameter is an ID I want to use in the report codebehind when building the datasource (e.g. Where customerID = paramID). I don't want to use the ID value as a filter.
The parameter, paramID, is already defined in the report designer with no Value.
In the ReportViewer, how do I set the report parameter, paramID, to the querystring value so that it will be used in the SQL query for the report's datasource?
In the ReportViewer page codebehind I'm trying the following but it doesnt' work:
Case "rptMyReport" 'this is the report name from the querystring
Dim appId As String = Request.QueryString("appId") 'this is passed from the first web page (Page1)
TryCast
(ReportViewer1.Report, wwnReports.rptMyReport).ReportParameters("paramAppId").Value = appId
Me.ReportViewer1.Report = New wwnReports.rptMyReport
Telerik.Reporting.Processing.TextBox textbox = sender as Telerik.Reporting.Processing.TextBox; |
string myParameter = textbox.Text; |
mysecondReport mysecondReport1 = new mysecondReport(); |
subReport1.ReportSource = mysecondReport1; |
((mysecondReport)subReport1.ReportSource).fill_DataSet(myParameter); // where fill_DataSet is my method |
public void fill_DataSet(string myParam) |
{ |
mysecondReportTableAdapter adapter = new mysecondReportTableAdapter(); |
myDataSet.mysecondReportDataTable table = adapter.GetDataBymyParameter(myParam); |
this.DataSource = table; |