Can't Use ReportViewer.ServerReport.SetParameters() When Parameter Values Are 'from Query'?
May 21, 2008
I have a report that includes two required parameters where the values are defined to be 'from query' and where the set of values displayed/allowed for the second parameter/drop-down are dependent on the selection from the first parameter/drop-down.
While this works fine in Visual Studio and via the ReportManager web interface, when I attempt to use the Windows Forms ReportViewer control and supply the parameter values via the ReportViewer.ServerReport.SetParameters() call the report does not accept the input values and indicates that no value has been supplied for the first parameter even though it was. Note that I am calling SetParameters() in code and not using the viewer control's parameter prompts (because they are ugly and allow for no validation beyond required/not-required).
I have tried a number of work-arounds but it seems that the only option is to change the implementation of the report so that the 'from query' parameters are no longer 'from query' but instead just simple input fields.
This allows the ReportViewer control and associated code to work, but since the input values I need are actually GUID values this is obviously less than ideal for running the report from Visual Studio or the web interface.
Am I missing something or is this some kind of a limitation/bug in the viewer control?
I'm new to programming with the ReportViewer object and this issue has me stumped: it appears if you have some optional parameters in your report, and a way to refresh that report with different parameter values, the report "remembers" parameter values from previous calls to SetParameters() on subsequent renderings of the report. If a parameter is included in a call to ServerReport.SetParameters() on the first rendering, but not included in a subsequent call and the report is re-rendered, the previous value of the parameter (rather than the default value) appears to be used.
Here's a snippet of some test code I wrote within an ASP.NET 2.0 test application:
retVal[paramCount++] = new ReportParameter("Name", txtName.Text);
if (txtAddress.Text != "")
retVal[paramCount++] = new ReportParameter("Address", txtAddress.Text);
if (txtZip.Text != "")
retVal[paramCount++] = new ReportParameter("Zip", txtZip.Text);
return retVal;
}
The test report was written to simply echo back the values of the parameters that are specified. The report definition allows NULL to be specified for the parameters.
The test app was written so if I enter a blank value for Name, Address or Zip, the corresponding parameter does not get created in C# and does not get sent to the report server. If I view the report with all three values (parameters) filled in, I see the parameters echoed back to me in my simple report as expected. If I clear the parameter values the first time the report is rendered, none are sent to the report server and I get no values echoed back in my report, also as expected. I can change the values and click on the View Report button and see the new values for the parameters as expected. However, if I clear any previously-specified parameters and click on View Report, the previously-specified values for the ones that are now cleared are still displayed by the report.
So my question is: once a parameter has been sent to the report, how does one "unsend" it on subsequent refreshes? I know I can create the parameter and set its value to null...but I have a situation here where that can cause errors. It'd be better if I could simply leave out the unspecified parameters and have the report refresh and render as if I were rendering it for the first time.
Here's my situation. I've got a report with some report parameters defined. These parameters get their available and default values from a query. I've got a Dataset and respective fields selected. The dataset in question is sort of a "headings" dataset, which only ever has one row. Now this works just fine when I'm previewing the report in designer, grabs the value, uses it as I'd expect. The problem is occuring when I'm using the WinForms ReportViewer control to view my report.
I'm not deploying this report, but running it client-side in the WinForms ReportViewer control. I'm providing it with the relevant datasets, bound appropriately (I can pull data from the fields directly in the report just fine), but when I try and view the report I get "The 'xyz' parameter is missing a value".
What's going on here? The definition seems acceptable as it works fine in designer, and my execution using the WinForms ReportViewer also seems to be correct, as I can use the fields otherwise. It just falls apart on the parameter default value from a query.
I have created an ASP.NET website with a ReportViewer on. The report renders fine, but when I change one of the parameters (manually), the report seems to invalidate itself and a blank while area is drawn. I would like the same behaviour as in the WinForms variant, where rhe rendered report remains the same until the 'View Report' button is pressed.
I designed an rdlc file to be used with ReportViewer in an ASP.NET page.
The data source I used was an Object DataSource.
When I placed the ReportViewer control on the page, an ObjecrtDataSource control was added too. I configured it for the parameters the report will receive. The first string parameter is named PRO_DES, which has a default value of "" and the data come from request.Form.
When I run the report in the page, the following error appears:
The 'PRO_DES' parameter is missing a value
PRO_DES parameter, since it is a string, could be empty.
I tried to set a default value, but the same message appears.
DataSource is correctly attached to the report, so I don't know where the problem can be.
I'm trying to rertieve specific RS 2005 report by passing WebApp control value (this.VCtrlNo.Text) to "CV Report" - name of my report with the following scripts.
1) No Action - when clicked. AutoPostBack is set and properly initialized.
2) This just opened the default page instead of specific report. <a href="http://localhost/Reports/Pages/Report.aspx?ItemPath=%2fReports+Folder%2fCV+Report&rc=Render&vctrlno=10-0000037", target="_blank">Open CV Report </a>
Where "Reports" is the reportmanager, vctrlno is the parameter name (properly set) and obviously I want to open a new page.
I would be very thankful to anyone who can lead to make this work.
I am creating a SSRS report using a SSAS cube as it data source. The user would like to select multiple values from a reporting parameter that is then used as a filter on the MDX statement. I am bale to have the report work successfully when only one value is selected but not when multiple values are selected; the report uses only the first value from the reporting parameter when it contains multiple values. How do I filter an MDX query using a SSRS report parameter with multiple values?
Hi, I've got this ssrs 2005 report that works great passing a few security related parameters from asp.net codebehind. However, there are two date related parameters that won't be coming from my web form, but rather from the report form itself. When I test the report's date parameters from visual studio it work fine, but when I attempt the same report from a reportviewer no matter what input I place on the report's date fields or even if I select the date picker, the report simply resets to default and reloads. And actually the date picker from the reportviewer does not not even pop up.
Partial Class _ReportViewer Inherits System.Web.UI.Page Private Users As New Retailer.Core()
Protected Overrides Sub OnLoad(ByVal e As EventArgs)
Dim Roles() As String = GetRolesForUser(Page.User.Identity.Name.ToString)
Dim cred As New Retailer.ReportServerCredentials("myuser", "mypassword", "mydomain") ReportViewer1.ServerReport.ReportServerCredentials = cred
Dim param As New ReportParameter("r_user", Page.User.Identity.Name.ToString) Dim param2 As New ReportParameter("r_role", Roles(0)) Dim p() As ReportParameter = {param, param2}
on my reportviewer form, at the top I have parameters for startdate and end date, they are not set to internal or hidden.
If I select the calendar icon, i get a javascript error
Line: 606 Object Required
When I attempt to debug I get a Just-In-time failed : Unspecified error. Check the documentation index for 'Just-in-time debugging, errors' for more information. So pretty much I can't see the error or javascript in question.
If i enter anything in the date fields, it disregards them setting them to the defaults.
Again, if i run the report from my vs.net client (not using reportviewer), i can select the calendar and enter dates and it respects them.
Any chance I need to patch sql server or reporting services? maybe ie. I'm on IE 7.0.5730.11 Could my problem be that selecting items on the report itself fails to send my credential information from my codebehind?
Myreportviewer.ServerReport.ReportServerCredentials, and let users access the reports on the report server no matter whether the asp app and report server are on the same server. I set up the username, password and domain for the network credentials, and set it to the reportServerCredentials. but when the app running, throught the reportviewer, the report can be access, but no data can be got from datasource(some parameters comes from queries on datasource, and they are unavaible and greyed). if I don't set the reportservercredentials but use <indentidy impersonate = true> and use the windows authentication(disable the anonymouse access) in the iis, it works well, but it works only when aasp app and reportserver are on the same server.
Our clients working with the Firefox browser on a Mac are unable to use the Multi-Value parameter drop down lists that the Report Viewer control generates. Of course I realize that the multi-select dropdown lists are not really dropdown option lists using the standard HTML select tag, but are rather tables within div tags with cells that contain spans, inputs, and labels.
Originally the report viewer displayed these lists in the wrong position within Firefox on any platform (Mac or PC). Furthermore, there were other visibility problems with those lists that made it virtually impossible to select a checkbox within the list. Fortunately, Microsoft fixed this problem with the latest version of Report Viewer, which we downloaded from the following link: http://207.46.19.190/downloads/details.aspx?FamilyID=cc96c246-61e5-4d9e-bb5f-416d75a1b9ef&displaylang=en
So currently we have SQL Reporting Services Report Viewer 9.0.21022.8 installed on our web server. And the dropdown lists do appear as expected, and they work properly in Firefox on a PC.
But, when the control is rendered in Firefox on a Mac, the list is not scrollable. The scroll bar that should appear on the right-hand side of the dropdown list, which would enable users to select values toward the bottom of the list, does not appear. That scrollbar is missing in Firefox.
This is likely related to a Firefox rendering issue with the overflow:auto style. There are numerous entries on the web that indicate Firefox for Mac has a problem with overflow:auto. For example: http://www.webdeveloper.com/forum/archive/index.php/t-96958.html http://www.daniweb.com/forums/thread44144.html http://iamthewalr.us/blog/2007/04/20/firefox-on-the-mac/#comment-2321 http://www.errorforum.com/mozilla-firefox-error/3503-will-float-mac-firefox-scrollbars-floating-pop-up-windows.html https://bugzilla.mozilla.org/show_bug.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&id=187435
That being the case, it seems that there should be some workaround to address this, either via a style or through some alternate control. Or perhaps there is a property that we can apply to the ReportViewer control that I'm unaware of which addresses this.
If you know of a workaround, or can suggest an alternate approach that we could implement quickly, please respond. Thanks.
I have a vb.net application using report services that has a big delay when I set the parameters with which to call the report.
I create a new reporting.reportviewer.
I set the ReportServerCredentials.NetworkCredentials, ReportServerUrl, ProcessingModem, ReportPath and everything is fine.
When I call SetParameters with a very simple parameter set, I get a delay of between 0.5 and 2.5 seconds. That delay is very noticible to the users. Below is an extract of a sql profiler trace to a database showing the start time, end time, event class and data text of the sql. I've marked the area with the delay in red.
I have no idea what is happening at that time, but Is there anything I can do to get rid of that delay?
It seems that it could be the first time the my application has had to interface with reporting services.
I have parameters in my report. The user can choose the year, month and date (3 parameters). Now I want to set default vaules for the parameters , so that the user sees the report for example for the current day without selecting the parameters. I tried to set the type of the parameters to DateTime and the default value for example for the year to "=Today().Year" . But when I execute the report an error occures . Something like : no validValue for this parameter.
My Attributes for the year month and date are from an Analyis Services Cube from a Server Time dimension . Does somebody know how to make it possible to set default values for this parameters?
Other question :
Does somebody know how I can reduce the values for a parameter. For Example I have a parameter "year" from a server time dimension from a cube. The values which are available are "Year 2004", "Year 2005", "Year 2006", "Year 2007". But I want that the user only can choose "Year 2006" or "Year 2007" ant not every Year or "All". Or Other Example: The User should only choose a Date that is int the past or Today but not a Date in the future.
Is it possible to fill a parameter list with values based on another parameter value? Here's what I have so far (which hasn't worked)... I'd like to generate a report listing information for a student. The report viewer would first select a school from the first drop-down menu, and then the second drop-down menu would populate with the list of students at that school. I have a dataset that calls a sp which returns a list of schools (SchoolID and SchoolName fields from the database table). I have another dataset that calls a sp (with SchoolID as the parameter) which returns a list of students for that school. Both datasets return the appropriate data when tested individually, but when I set up the Report Parameters and build the report, these errors come up... The value expression for the query parameter '@SchoolID' refers to a non-existing report parameter 'SchoolID'. The report parameter 'Student' has a DefaultValue or a ValidValue that depends on the report parameter "SchoolID". Forward dependencies are not valid. ...Is it possible for the reoprt to generate a list of available parameter values based on the value selected for another parameter? Any help you can give me would be great!! Thank you
I have my stored procedure set to Territory_code IN (@Territory)
, now , how do i enter in more then one value. When i select the multi value check box, it gives me more spaces. But then doesnt recognize the values when i put in more then one. am i doing something wrong?
I have a parameter (hidden) that gets its value using an expression base on another parameter. When in the designer, the first time when the designer loads I can select the Parameter that controls the child parameter (expression lies in the default value section). The value changes.
When I change the parent parameter again, the value of the child parameter does not seem to change.
How can I make this parameter change automatically when the parent is changed ?
If I have a Select statement like this in my C# code: Select * From foods Where foodgroup In (@foodgroup) And I want @foodgroup to have these values ... "meat", "dairy", fruit", what is the correct way to add the parameter? I tried meat, dairy, fruit 'meat', 'dairy', 'fruit' but neither worked. Is this possible?
Hello!I have tables "forum_topics" and "forum_categories":forum_topics:-topic_id-topic_title-topic_cat_id-topic_user_id-topic_dateforum_categories:-cat_id-cat_name For example: I have 5 categories in table forum_categories and by this query I can display topics from 2nd and 3rd category only. So I'm using this query:SELECT topic_title FROM forum_topics WHERE topic_cat_id IN (2;3)Now I want to parametrized this query by one parameter, so: SELECT topic_title FROM forum_topics WHERE topic_cat_id IN (@param)And I want to input this parameter lik in the query first - so @param = "2;3"But I have a problem to make this works, can someone explain me, how to solve this problem ? Thanks.
Let's say i've got simple table with only one attribute - primary key. I'm populating GridView via SqlDataSource, however dunno how to update PK - how to pass new-updated value and old value (to locate the right record to update) as the UpdateCommand parameters from GridView control. Simple update sample using SQL statement: update TABLE_NAME set PRIMARY_KEY = @NEW_VALUE where PRIMARY_KEY = OLD_VALUE Thank you for your kind help.
In creating a report, how can you display a parameter selection that is a choice (for example, yes/no) where the data that is passed to the query is translated for the query. Selecting 'yes' would pass, for example, 'internal' to the query and selecting 'no' would pass 'external'.
Is this a setting that can be adjusted in Reporting Services, or is this just a matter of how I write my queries?
I am seriously stuck in SQL Reporting Services. And don't know where to go and what to do in order to achieve what I want to achieve.
1. In my report I have the following parameters. SiteID, Document Name, Document Location and Action. These values are picked from the database through queries and filled in the parameter combos.
2. I want the user to be able to view the report for 'Any', 'All' and/or 'None' of the values in the parameter.
e.g. 2.a. The user can generate the report and return all values. 2.b. The user can generate the report with a particular 'SiteID' but all Document Locations, Document Names and Actions. 2.c. The user can generate the report for 'All' SiteIDs, but one Document Location, 'All' Documents and 'All' Actions.
etc.
I was trying this out with parameters. But it wasn't working. Meaning, first of all I wasn't able to get 'All' from the database.
Can someone please help me out, or at least point me in the direction where I should be looking, since I have run out of options.
I have a problem with reports parameters. When I enter the parameter value , Report shows the same value no matter what the parameter value is. Here is my code.
Code Block WITH yesterdayCTE AS ( SELECT type = 'Members Joined Yesterday' , Borrowers = (select count(*) from LoanApplication where LoanApplication.SubmittedOn >= GETDATE()-1) , Depositors = (select count(*) from CDOrder where CDOrder.SubmittedOn >= GETDATE()-1) , CreditUnion = ( select CreditUnion.Name from CreditUnion where (CreditUnion.Id = @CreditUnionID) ) ), last7daysCTE AS ( SELECT type = 'Members Joined Last 7 Days' , Borrowers = (select count(*) from LoanApplication where LoanApplication.SubmittedOn >= GETDATE()-7) , Depositors = (select count(*) from CDOrder where CDOrder.SubmittedOn >= GETDATE()-7) , CreditUnion = ( select CreditUnion.Name from CreditUnion where (CreditUnion.Id = @CreditUnionID) ) ), last30daysCTE AS ( SELECT type = 'Members Joined Last 30 Days' , Borrowers = (select count(*) from LoanApplication where LoanApplication.SubmittedOn >= GETDATE()-30) , Depositors = (select count(*) from CDOrder where CDOrder.SubmittedOn >= GETDATE()-30) , CreditUnion = ( select CreditUnion.Name from CreditUnion where (CreditUnion.Id = @CreditUnionID) ) ), combinedCTE AS ( SELECT * FROM yesterdayCTE UNION ALL SELECT * FROM last7daysCTE UNION ALL SELECT * FROM last30daysCTE ) SELECT * , Members = Borrowers + Depositors FROM combinedC
I'm creating a procedure to fetch rows from table. One field will come come as IN(). Its the condition. That field is numeric field (note down), i would like to pass the In values as parameter.
eg: procedurename @fieldvalue varchar(100) as begin ...
WHERE fieldname IN(@fieldvalue)
while executing the procedure how to pass the value... or procedure itself has problem...? Help me...
Is there any way to validate the input paratemers for the report? For example: I want to restrict the value to be less than 100 in one parameter. How to achieve this?
I have some 5 parameters which I've specified as multi-valued and my report uses a stored procedure. When I select all values in my dropdown (parameters) within my reports nothing shows up. How can I pass multiple values of a parameter into my stored procedure such that it works?
I am having a serious problem developing my reports within VS2005. For no reason, on one of my report it seems the parameters have got a life of there own.
There is a collection of 4 parameters whose values change randomly (internal, hidden, multivalue). Regardless of what I set them to, once I click save some change, when I alter 1 parameter, the values of one of the other parameters change while the settings for the parameter I changed to not apply.
What is going on here, I have been developing reports without issue however this is becoming a major concern. Please help!
i wanna know ,where to keep configuration parameter values either in an config file (xml), or a parameter table. i have it in xml and its working fine , but for a few of them , i need a greater fleximibility to change the values at any time, so was considering a param table.
the problem is that , a common package which reads the config from xml , now will need to read it from a table , while in case of xml , a file path can be assigned to a variable to be used by the package, but here, i dont have any db connection specification, it may be loaded on various servers. is it feasible..to use a parameter table...??
I am deploying an rdl that is being deployed in a server.But i am encountering a problem regarding the valid values of the parameter.My parameters have dependencies,and one of my parameter comes out with two dependencies.
Scenario : User needs to input his userID to access Book A. Book B needs Book A because the output will be depending on the its content. And Book C depend on Book B.
Problem: when deploying, only Book A will have the initial value.The dependency in Book B is only one,which is fine.It shows its valid values. But how about for Book C which have 2 dependencies? Because it doesnt show it's valid values..
Code Snippet SELECT Portfolio, RptSection, RepExcRsn, Report, SUM( Units) as TotUnits , FROM Exc_SummaryData_Custom WHERE (Report = 'Exc') AND (RepExcRsn = 'Grand Total') AND (RptSection ='New') AND (Portfolio IN (@Portfolio)) GROUP BY Report, RptSection,Portfolio, RepExcRsn
UNION ALL
SELECT DISTINCT 'ALL UP' AS Portfolio, RptSection, 'Grand Total' AS RepExcRsn, Report , CASE WHEN Portfolio = 'ALL UP' THEN (SELECT SUM(Units) FROM Exc_SummaryData_Custom WHERE Portfolio IN ('CBank','DTC','EDirect', 'InstLend','ALL UP')AND (Report = 'Exc') AND (RepExcRsn = 'Grand Total') AND (RptSection ='New') ) ELSE 0 END as TotUnits , FROM Exc_SummaryData_Custom WHERE (Report = 'Exc') AND (RepExcRsn = 'Grand Total') AND (RptSection ='New') GROUP BY Report, RptSection, Portfolio, RepExcRsn
My problem is when I input a value for Portfolio parameter, i get two rows instead of one. If I input 'ALL UP' then I get value only for ALL UP. But if I input smthing else , then I get values for that paramter value as well as ALL UP thus giving me two rows not just one as I want. Case stament always gives me 0 value for ALL UP which is not the true value. can anyone help me to correct this?