Error in Choosing the Multiple value from Query in SSRS - reporting-services

I am very new to SSRS. I have a query related to filter. I have a single table and declared a Parameter. I want the Parameter pick the value from table and able to select the multiple values.
In Parameter Tab: 1. General I choose the "Allow Multiple Values"
2. Available Values: I choose the "Get Value from Query"
In Database Properties
1. Go to Filter & Chose Operator "IN" and Select the parameter
Please help me.
Error mesg

It looks like you have based your parameter values on the same dataset that you are trying to filter with the selected parameter. This is obviously impossible, as how can the query run to populate your parameter if the query depends on the value of the parameter to run?
Create a second dataset that just returns the Value and 'Label` you need for your data driven parameter and then use that as your parameter values.

Related

Multi-value Parameter missing value ssrs

I have multiple datasets in a report. There is one main dataset which brings in all the Contacts that follow criteria which I then pass to one of my multi-value parameters i.e. ContactIDs by selecting its available and default values to be derived from the main dataset.
Other datasets have a condition built in that they should bring data only related to the contacts in ContactIDs parameter.
Everything is fine until the main dataset returns any records. The moment there is no data or contacts I get an error saying "Parameter ContactIDs is missing a value
I have seen a lot of workarounds which suggest putting a default value in the parameter but I don't see an option to putting a default value and getting rest of the values from the query.
Major consideration
The query is not SQL, instead its FetchXML so there is no scope for me to return a blank or zero or anything if there are no records.
Any suggestions?

Display selected values of multi-value parameter in tablix rows

I am designing a report for SSRS. I want the user requesting the report to be able to specify, when they generate the report, from a pre-defined selection some values which should be displayed in a tablix on the report.
I have therefore created a multi-value parameter and populated the Available Values with the options I want the user to be able to select from, and, as expected, when the report is generated the user is able to select one or more of these values.
However, what I now want to do is include a tablix in the report, and display a row for every value in the multi-value parameter that the user selected, with the value displayed in the first cell of the row.
If the values were coming from a data table this would obviously be easy. I've also found answers on how to show all of the selected parameter values in a single textbox using the JOIN function, but I don't want to do that.
The only solution I can think of is to replicate the list of available values in the multi-value parameter in a tablix manually, and link the visibility of each row of the tablix to the selected state of the corresponding value in the multi-value parameter, but that's not very elegant and increases the effort involved in maintaining the report definition.
Any ideas on how to do this? I know the selected values from the parameter simply form an array, but I can't see how to bind a tablix to any data that isn't in a dataset, or how to create a dataset from the parameter values.
Considering that a tablix sources from a dataset, I did some experiments to see how to create a low maintenance solution for you.
Option 1: Create a data set with hard-coded options to match your multi-value parameter and select those options WHERE they exist in the parameter.
Example:
SELECT val
FROM (
SELECT 'opt1' as val
UNION SELECT 'opt2'
UNION SELECT 'opt3'
UNION SELECT 'opt4') a
WHERE val IN (#Param)
Thoughts: easier to maintain than visibility on a table, but still two hard-coded places within the report.
Option 2: Create a dataset that selects the multi-value parameter and splits it by each value. This was my first idea, but I ran into some issues with determining how to actually select the multi-value without a syntax error. I came up with a method that creates a deliminated string in the report and than parsed that string back into rows in the dataset:
Step 1) Within the dataset properties, on the parameter tab, join the multiple values together with a JOIN expression
Step 2) Create a simple query which uses the new SQL Server 2016 function string_split. Note that your database compatibility level MUST be 130 or higher to use this function (SQL 2016+). If this isn't your scenario, there are many string split functions that you can find on Stack Overflow to achieve the same thing.
Fun problem!

SSRS Parameter update field

I need to update parameter names in my Report based on "Language" parameter value.
So, when i choose one language, other parameter names should change.
Is it possible? If yes, is it possible from Report Builder?
If by Parameter Names you mean the values displayed, then yes you can have one parameter selection update another. A typical example would be to choose a country in one parameter and then choose a city from that country in a second parameter. It's called Cascading Parameters.
The basic idea is that each parameter will be based on a query and each query will use the previous parameter.
Country dataset for #COUNTRIES parameter:
SELECT COUNTRY FROM COUNTRIES
City dataset based on other parameter for #CITIES parameter:
SELECT CITY FROM CITIES WHERE COUNTRY IN (#COUNTRIES)
Here's some more information from MSDN
You can not change the other parameter names based on one parameter.
It is not possible to update parameter name, as parameters are mapped in dataset from the query or stored procedure running on the back end, so there is no such way to update that query/stored procedure parameter name once the SSRS report is running.

How can i run the report without specifying the parameter value in SSRS

H, I have a parameter 'Client' as drop down in SSRS report. My requirement is to select all the records for all the clients if i don't select any parameter value and if i select particular value in the drop down,i need to display records for the that particular client.
I am getting the list of clients as a input from query.How can i add option select all by default.
Thanks in advance
You can do this a few ways...
Check the "Allow Multiple values" on the general tab of the Parameter Properties, go into the Available values and select the dataset you are using to get the values, make sure the the column that contains the actual data to search on is what you select for the VALUE field...(with this one - make sure your query eliminates the NULLs for the Value field) then you will have a drop down with all the values and it will add Select All...
Then in the Default Values tab, you can hook to the same query and select the VALUE field again... (as long as there aren't any NULLS) You may need to do tweaking depending on your query and values...
or
You can check the "Allow Null Value" on the General tab in the Parameter Properties, then in the Default Values - select "Specify Values", then Add, and (null) pops in there automatically...
Then call a stored procedure where the parameter defaults to NULL and if you pass NULL or don't pass in a string of values, your query will return all (not sure how you'd implement this if your query is embedded in the report... I try to do all of mine in Stored Procedures..)
Add "All" to the results of the query that returns a list of clients for the drop-down and make it the default selection. Then handle it in your main stored procedure that if "All" was selected, you don't filter by clientId, and just get all clients.

SSRS set last row as default value for multi-value parameter

I guess that's easy... I have a multi-value parameter that got the list of values from a query. I would like to select as default value the last row.
Can I achieve this using a expression? I would like to avoid creating a second query just to get the last value from the previous query...
In the default parameter expression you can't refer to the field of the dataset, so you can't write something like Last(Field!MyVar.Value, "DataSet1"), as a workaround you can order your dataset to retrive last row as first and use "Get values from a query" which choses first row, if you can't do this then replicate your dataset in the only one solution.
I am working with SSRS 2012 and I was using a multi select option on my report so when I chose the "Get Values from a query" I got all of the values as the default.
I did find a solution. In my report I needed the default name of the town to be the first one so I created another set with the name of the column and a calculated measure that said "[DimTahanot].[Tahana Name].&[אילת]" and filtered it by the same one. (Please ignore the different language). Although hard coded it was good for this report. You could create another hidden parameter for this set if you need it to be the first one by amount or any other parameters that should effect this value, using the filter as a parameter.
Hope this helps.