report builder 3.0 cascading parameter for bool - reporting-services

I am building a report in SSRS 2008 R2 Report Builder 3.0. In this report i have a Parameter named #CustomerID, a list of Customers in a dropdown. I then have a number of Bool Parameters eg. #UseFirstName and #UseLastName which are based on settings for each. The population of #UseFirstName and #UseLastName work fine for the first customer i choose but when i choose a new customer the values are not updated.
Obviously the population the first time is working against the dataset but after that it stops getting updated when i choose customer in the dropdown. Any ideas?
i have set "always update" on all my parameters.
Code for getting the parameter data:
SELECT * FROM pen.CustomerReportSettings
WHERE (CustomerID = #CustomerID)

I don't think the bool parameter radio group will work the way you want it. The only thing I can think of that will get you close is to force the bool parameters to a text datatype and set the default values to "Get values from a query" with the value field being the field related to the parameter. You also need to specify the Available Values as "Get values from query" to force the parameter to reload when the #CustomerID changes. This should yield a drop down box with one selectable option and the value of the dropdown set to that option.

Related

Cascading parameters in SSRS reports doesn't work with one parameter value set to a default value

I'm trying to run an SSRS report with cascading parameters.
I have 2 parameters para1, para2.
I have made para1 as a hidden field and assigned para1 a default value.
I have set para2 to take available values from a dataset.
I'm trying to populate para2 drop-down based on para1's default value.
My query for populating para2 is
SELECT column2 FROM TABLENAME
WHERE (column1 = #para1)
(here column1, column2 from Database refer to respective para1, para2 parameters in report)
I have my query working fine with the database and I see filtered result but gives me an error when I click preview on BIDS.
Error:
The report parameter ‘para2’ has a DefaultValue or a ValidValue that depends on the report parameter “para1”. Forward dependencies are not valid.
I'm unable to figure out where I'm going wrong. Please help me find my mistake. Thank you.
Change the order of your parameters in the parameter list.
On the menu bar click View>Report Data
Then highlight one of the parameters and click the up or down arrow (depending on the highlighted param)
The up and down arrows are located at the top of the Report Data list. You should end up with Para1 being above Para2 in the parameters list.

ssrs - Forward pointing dependencies are not valid

In an existing SSRS 2008 r2, report, I am attempting to add a parameter called 'Customer_Category'. I am getting the following error message:
The report paramter 'CustomerNumber' has a DefaultValue or a ValidVaue that depends on the report parameter 'Customer_Category'. Forward pointing dependencies are not valid.
I am trying to determine how to fix this error. The 'CustomerNumber' is a parameter value that is obtained by reading from a dataset. In this dataset there are existing other parameters called 'Customer_Type' and 'Customer_Preference'. Both of these parameters obtain there values from selections that the user makes when the SSRS report is executing. There are no default values.
I am trying to have the 'Customer_Category' be the same way where there are no default values and the user must select the parameter value when the report is executing. There should only be one value that the user can select from.
The new parameter called 'Customer_Category' is the last parameter in the list of parameters. Does the order of parameters make a difference? If so, how can I move the 'Customer_Category' parameter in front of the customer_number parameter?
Here is the sql that is used from obtaining a list of customers from the dataset for customer_number:-
SELECT Distinct CustomerNumber
FROM BridgeUserCustomer
WHERE
Type = #Customer_Type
AND Preference = #Customer_Preference
AND Category = #Customer_Category
GROUP BY CustomerNumber
Would you tell me what is wrong and what I can do to solve the problem?
Summary
The order of parameters in your IDE (Report Designer or Report Builder) matters.
If you have a hierarchy of parameters (one level dependent on the other), the top-level parameter must appear first in the parameter list.
In SSRS these are referred to as cascading parameters.
Solution
Open the Report Data tab
Expand the Parameters folder
Select a parameter and use the up/down arrows to adjust order
Report Designer
Report Builder

SQL Server Reporting Services - Set default value for multi-value report parameter

I have a report in SSRS and one of the parameters I use is Cities. The user can select from a list of cities to pull the report for that location, or multiple locations. My datset is simply a select * from tblCities. When I run the report, I do see that one of the options is "Select All." But, I'm wondering - is there a way I can get this "Select All" option as the default value, so that by default all cities are selected?
And, along those lines, but a separate question - is it possible to make this drop-down optional? I have tried the allow NULLS checkbox, but for multi-value parameters, it seems SSRS does not allow this.
FYI - I have only begun using SSRS; know very little about it.
is there a way I can get this "Select All" option as the default value, so that by default all cities are selected?
Yes you can.
Open the Report Parameters dialog: Layout tab, right click anywhere on the canvas that is not the report, select Report Parameters
Select the parameter (cities in this case), from the list on the left
Select the appropriate default setting in the default section, lower righthand corner
One option is where you can statically define a value. IE: =0 or whatever the value is for the Select All option. FYI: I've found that what works in the Visual Studio preview doesn't work when live.
Another option is if the list of cities comes from a stored proc, you order the output of the sproc so Select All is at the top of the list. Then you select the radio button under the static value one (can't remember, not at work to check ATM) - you'll have to select the dataset the sproc is associated with, then the column that the value comes from.
is it possible to make this drop-down optional?
When you say "multi-value", are you actually able to select multiple values from the list? IME, all you get is a drop down & can only select one of the options available.
Allowing null is just an accepted value - the optionality is really handled in the query so that if a sentinel value is provided then the criteria isn't included in the query. IE:
AND (#cities IS NULL OR t.city = #cities)
That's quick & literally dirty. ORs are poor performance.
Make these changes to the specified report parameter:
In order to have all fields selected, make the [dataset] and [valuefield] at "Available values:" equal to the [dataset] and [valuefield] at "Default Values" (assuming you have a query for determing this)
In reports when we want to default the multivalue parameter to 'Select All' following are the steps.
Open the Report parameter window from the Report menu.
Select the Report parameter from the left handside of the window.
Select 'Multi-value' checkbox and appropriate 'Available values'.
Under default values select 'From Query' radio button'.
Select the appropriate 'Dataset'.
Select appropriate 'Value Field'.
Save the Report and select Preview Tab. You will find all the items selected in the multivalue parameter list and the result displayed for all the selected items.
Go to the either the Data tab or the
Layout tab.
From the Report menu, select Report
Parameters
Select the desired parameters, in
this example, cities
In the lower right hand region of the
screen, set the Default values radio
button.
Set the Dataset and Value field drop
down lists to the exact same options
as the DataSet and Value field sections from the Available Values settings above.
This assumes that you are using the "From Query" option under "Available values" If you are using the "Non-queried", see the answer by OMG Ponies.

Parameter missing a value

I am new to reporting services and have a reporting services 2005 report that I am working on to use as a base report template for our organization. I am trying to place the date that the report was last modified on the report server into the page header of the report. However, I keep getting a 'ParamX' parameter is missing a value error when I try to This is what I have done:
Set up a Parameter ReportName with a default value of Globals!ReportName. It is also hidden and internal.
Set up a Dataset ReportHeader that calls a stored procedure that returns the date the report was last updated or another date, if the report is not on the report server. It has a parameter #ReportName assigned to the Parameter!ReportName.Value. The Dataset returns values when run on the dataset tab in the BI tool.
Set up a Parameter ReportVersion that has a default value Query From based on the dataset ReportHeader and picking the ModDate column. It is the last parameter in the report parameters list.
I assign a textbox to the parameter.
When I preview, I get "The 'ReportVersion' parameter is missing a value whether I place it in the report body or page header (which is where I want it). I have deleted and added the parameter again, toyed with the hidden and internal settings on it.
What does this error really mean, what I am missing, and can I even do this with parameters?
Thanks In Advance
Jim
If I understand what you're doing, it sounds like you want to be using a field where you're implementing a parameter...
You are returning the ModDate from the data source, correct? If you're doing this, you can simply throw a text box in there, and use something like this: =Fields!modDate.Value to display it.
Parameters are values that go in to the query, fields are what it returns.
Hope this helps...
EDIT:: OK so are you trying to retrieve the mod-date column value from the reportserver db? If that's what we're talking about, you'll need to add a few things to the report. Add a datasource to report db, a dataset containing the date (query below), a list object in the report linked to the dataset, and a textbox in said list object to display the field. If you hit the report server with a query like this:
SELECT MAX(ModifiedDate) AS ModDate FROM catalog WHERE name='myReportName'
That will return your modifieddate from the ReportSErvices Database as a field that you can use.

SSRS: ASP.NET ReportViewer parameters reset to default when clicking View Report

I have a SQL Reporting Services report (SQL 2008 built using Report Builder v2.0) which has a multi select integer parameter (in this case a list of stores).
The default value is 0 ("All Stores"). The parameter is passed to a stored procedure as a varchar(1024).
This all works fine in Report Builder or from the Reporting Services website.
However from an ASP.NET website using the ReportViewer component the parameters are reset to the default each time you choose "View Report".
I've tried setting the view to non-asynchronous loading (changes the rendering container?) plus any other setting I could find, without success. Does anyone know a trick to fix this?
I made a mistake. The ReportViewer control was inside a Master Page. Each time the "View Report" button was clicked it did a postback and reset the session.
I added if (!IsPostBack) to before the report setup method.
For those of you who experience this error for reasons not listed by the original poster...
Here is a similar scenario.
You have a report which uses a multi-select report parameter.
This parameter is populated by a datasource, which bases its values off some table query.
When you use the 'Select All' option for this report parameter and press the 'View Report' button, the parameter is reset to blank and your report is not generated.
I believe this problem occurs because something invalidates your dataset while the query is being performed, but I cannot be 100% certain.
What I do know, is that by using a table variable as the dataset's query source, you make this problem go away.
For example, your CityDataSource could be populated by the query:
SELECT DISTINCT city, city as SortOrder from accounts
UNION
SELECT 'All' as city, '0' as SortOrder
ORDER BY SortOrder
If you've been making SQL Reporting Services reports, you may have stumbled upon this solution once or twice.
Now, we change the CityDataSource query to look like the following:
DECLARE #citytable TABLE (city varchar(255), sortorder varchar(255))
INSERT INTO #citytable (city, sortorder) VALUES
(
SELECT DISTINCT city, city as SortOrder from accounts
)
SELECT city, sortorder FROM #citytable ORDER BY sortorder
And by doing that your report's parameters won't reset anymore.
A stored procedure would also work, I suspect.
I found a similar code error as the original poster. I was (re)setting the report server credentials every time the page was loaded, instead of just when it was initialized. Apparently, setting the report credentials resets all of the parameters.