I have two parameters that give a date From and To.
I have two datasets that have the dates in the same format, but use two different dimensions. They both provide, Calendar Year, Calendar Month and Period.
I am trying to pass the value of the two parameters to two hidden parameters for the second dataset. I am not getting the expected data.
For example, I am passing 2017 and 2018 as From and To, but when this is passed to the hidden parameters, I am getting back the value for previous years as well.
Can someone post how they would pass a parameter value to a hidden parameter as I am clearly doing it wrong.
When setting up the hidden parameters, I am choosing to get default and available values from the visible parameters that appear in the dataset drop down list. Value field is ParameterValue. Label field is ParameterCaptionIndented but I am unsure what this is actually doing.
Following suggestion, have tried this
value will not update when parameters are changed
If both datasets are to use the same parameter values, there is no need to create two sets of parameters and awkwardly try to pass the value from one parameter to another.
If the parameters of your second dataset have different names, no problem, the Dataset Properties window contains a Parameters page that allows you to map the dataset parameters to your existing parameters, so you can re-use the visible parameters created for the first dataset and remove the other 2 parameters that were probably created automatically.
Related
I am passing a unique ID as parameter in SSRS report. In the source table, unique id does not contain dashed. However, the user may insert Unique ID including dashes "-" and in some cases without dashes. Is there a way that we could remove dashes from the parameter.
For example, unique id 3120-20268-8 is stored in table as 3120202688. How I could retrieve if user pass multiple values with or without dashes in the SSRS Report.
When is used below query, it gives record against single value only. However, gives error when more than one values are provided.
select * from Table
where Unique_ID in (REPLACE(#Unique_ID,'-',''))
For more than 1 values, it gives errors mentioned below:
The replace function requires 3 argument(s).
Query execution failed for dataset 'ATL_List'.
Thanks
One of the simplest mechanisms for this is to create an expression based parameter to hold the sanitised input. This parameter would be hidden so the user is not aware of it, but the rest of the usage of the parameter is the same.
NOTE: You could do something similar with a query based default value, but this case is easier to do via a simple expression
Single Value Parameter
Create a new parameter:
set it to hidden
Set the default value expression:
=Str(Parameters!inputID.Value).Replace("-","")
Multi-Value Parameter
This is only slightly trickier, in the expression we can join the selected values together into a CSV string, then process that value and then split it back:
Set the parameter to multi-value, but still hidden:
Set the default value expression:
=Join(Parameters!inputID.Value,",").Replace("-","").Split(",")
Without going to detailed, if we made the sanitised parameter temporarily visible, just to demonstrate the conversion, it should look like this:
The parameter MUST be hidden!
NOTE: DO NOT make your sanitised parameter visible as in the above screenshot in your deployed report! Doing so will mean that it will not pickup changes made to the input value after it has rendered the first time.
remember that we have exploited the default value, we haven't arbitrarily defined en expression to always execute.
The output when the parameter is hidden is calculated when the report is rendered, it's just harder to visualise the behavior in this static post:
In your DataSet query you would just use the sanitised parameter:
SELECT * FROM Table WHERE Unique_ID IN (#sanitisedMultiValue)
You should be able to use the replace function in your report to format the parameter value after it has been entered, something like the below
replace(Fields!Paramater.Value,"-","")=FieldinYourTable
I'm using MS Report Builder v3.0 to create a report. As part of this report, I have a multi-valued parameter (named #Diagnoses). The labels and some of the values (truncated by the size of the display boxes) of this parameter are shown below:
What I would like to be able to do is display the labels / values the user chooses in a 2-column tablix (I've tried using separate textboxes for the labels / values but the results are mis-aligned).
However, this does not appear to be straightforward. The closest method I've found is this one, which stores the user's choices in an internal parameter in xml format, then queries this parameter to produce a dataset from the xml.
So, I created the xml-producing internal parameter like this:
...and I've created a dataset based on this data, with the following query:
But now when I put these values into a tablix, the labels and values are now on separate rows, like this:
Does anyone have a straightforward way of sorting this out?
Best Wishes
C J
OK - I've solved it (it's not pretty, but it works!)
Basically, the problem comes from having to use the join statement when creating the xml - you can't really put both the label information and the value information on the same row in the xml.
To get round this, you have to use two internal parameters to create two datasets - one for the labels column, one for the values column. The method for creating these is essentially the same as that shown above, except for the values parameter, the expression for the default value is:
...and for the labels parameter, it's this:
(by the way, make sure you set the available values to "None" for internal / hidden parameters - the expressions here are for the default values)
Then, when you create the values dataset, you use the following syntax in its query:
...and similarly for the labels dataset.
Finally, in the report, you create one matrix from each of the two datasets, then put them next to each other, using fixed row heights and setting "can shrink" / "can grow" to false so that they look like they're in the same table:
I hope this helps somebody!
I want to store the first value obtained by a parameter across reports in one textbox.
The parameter value will change each time and all I want to do is to capture the first initial value and show in report.
I tried storing the parameter value as read only variable and didn't work.
Any suggestions on this is really appreciated.
I'm using an embedded data source of type SharePoint List.
I use a parameter that a user can modify that will filter the data set by the month. I've seen a few examples but they all either use a SQL query or only filters on the exact day rather than the month.
I added a parameter ParamMonth and gave it the data type of Date/Time. I can see this adds a drop down box to my report which is exactly what I want. Ideally, I would like to add the name of all 12 months or something similar, but I don't know how that will work out when the data exceeds a single year. Now, that I've got my Report Parameter added, I need to add it to my dataset to filter on. This is where I'm stuck.
An easy way could be creating a parameter type Integer and set all months in Available Values tab as follows (I just set five months for example).
Then go to the DataSet Properties / Filter tab and use the below settings.
For expression use:
=MONTH(Fields!Date.Value)
Where Date is the field that you will use to filter by month. In Value you have to use:
=Parameters!Month.Value
UPDATE: Provide year selection.
The best approach for this is getting the available values from a DataSet, in this case your SP list.
Just create a calculated field in your dataset with available years (it can be a copy of the SP list dataset), call it calculatedYear and use:
=YEAR(Fields!Date.Value)
Now create a Year parameter of Intenger data type, and set this settings:
Where DataSet15 is the DataSet name that feeds your parameter with the available years.
Then just add another filter in your dataset:
Note you will need two datasets one to get the available years and
other the dataset you need to filter.
Let me know if this helps.
So, I'm stuck on how to resolve this issue.
I would like to use the same Dimension & Hierarchy two times.
The dimension and Hierachy is already used one time to exclude a column value.
Now I would like to add a parameter to the same hierachy/dimension (with acfource the earlier rule applied)
And I can't get my head around to solve this.
If I'm understanding your issue correctly, then the solution is fairly simple. For each parameter that requires a dropdown list you need a different dataset in your report. For the first parameter (#p1), set available values and labels based on the result of a query.
In the dataset for the second parameter (#p2) which should have a filtered dropdown, have a second dataset that will be used to set the available values and labels of the second parameter. In this dataset, you want to reference the value of #p1 somewhere in your query. Upon opening, the report will generate the results of the first dataset to populate the first parameter's dropdown list. Once a value has been selected for #p1, the report will generate the second dataset to populate the options for the #p2 dropdown list. In this way, you can dynamically filter the options available to the dropdown list for the second parameter.