SSRS show parameter values in header - expression

I am trying to add an expression in header section, which would display parameter value chosen by users (if everything selected, display "ALL" instead). I am having trouble with "Property" parameter.
Report structure:
Report is a matrix report that shows data by year and grouped by refBuildingID. Parameter "Property" is based on RefBuildingID. I want to show these parameter values in header when users run this report.
Expression:
=IIF(Countrows("BuildingID")=(Parameters!refBuildingID.Count),"All",Join(Parameters!refBuildingID.Value,", "))
Error:
The Value expression for the text box ‘Textbox31’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset.
Is there a way to get around this error?

Try this method:
=IIF(Count("BuildingID")=Count(Parameters!refBuildingID.Value),"All",Join(Parameters!refBuildingID.Value,", "))

i think CountRows will work
=IIF(COUNTROWS("BuildingID").Equals(Parameters!refBuildingID.Count),"ALL",Join(Parameters!refBuildingID.Value,", "))

Related

How pull in fields value from created parameter

I created a parameter [GroupID] that is used to query several datasets in my SSRS report. It is using the field [GroupID] from my GroupList_Rolling12 dataset. An example of [GroupID] is 77610N. When 77610N is selected, all of my datasets are correctly 'filtering' for this [GroupID].
I now need to create a text box that returns the [GroupName] of [GroupID]. In other words, when 77610N is selected from my GroupID parameter, I want the [GroupName] that is associated with the selected GroupID parameter to display.
I'm still very new to SSRS and cannot figure this out. I tried creating the expression =First(Fields!GroupName.Value, "GroupList_Rolling12") but that did not work since it simply returns the first value from the query.
I also tried =First(Parameters!GroupID.Value(0)) but this also did not work
I also tried this expression =Lookup(Fields!GroupID.Value, Fields!GroupID.Value, Fields!GroupName.Value, "GroupList_Rolling12")
)
Can you please help?
You can reference the parameter label directly like this
=Parameters!GroupID.Label
There is no need to put the index on the end (=Parameters!GroupID.Label(0)) unless your parameter is multi-value, in which case it would select the first selected entry.

Hidden Parameter is missing a value

In my report, i have created a xxx parameter which takes values from the report data set.
xxx parameter is not being passed to stored proc which is used to show the data for the report.
Now When the report does not have any data for other parameters, i get an error saying xxx parameter is missing a value.
I tried allowing blank values in the parameter properties.
Check that parameter's - Available Values by going to report parameters properties.
It must not be specified any values. So we should set it as None
Another way is,
Just add a blank space at Specify values - in Default values inside report parameters properties.
Third way
Ido an "if exists" statement for this to go away. It worked for me because it makes it always return a value even if that value is not need by my query.
if exists (my select query)
my select query
else
select '2'
// '2' would never be used, but it made ssrs stop giving me
// the stupid error and execute
This should help.

Browse field data shows value, but displays another value

I have a formula written for a field in Crystal Reports. When i refresh the report, i get a different value from the formula. The required value is always the last value in Browse Field Data dialog for that formula.
Isnt the formula supposed to have only one value as output? why are multiple values shown in browse field data dialog.? Is there a way to retrieve last value of Browse File Data dialog?
My formula looks like below:
WHILEREADINGRECORDS;
NumberVar CODTOTAL;
if {XXX.YYY} = 1 then
( CODTOTAL := CODTOTAL + {XXX.ZZZ};
);
CODTOTAL;
Browse field data shows all the values "CODTOTAL" acquires as a result of that formula and displays a random value amongst the assigned value.
Please help me out. I am amateur in crystal reports.
Any help would be highly appreciated.
~Regards.
First observation should be where have you placed the formula (Details, Footer.. etc).
why are multiple values shown in browse field data dialog.?
Browse field shows the data that is present in the table but in your case you are applying "If" condition of the filed. It can be possible that there is only one record that satisfies your condition.
I would suggest to run the report without the codition, Check the results and apply the condition and check results again.

MDX Parameter - SSRS

Parameter Value (It’s Unique Name) = [Company].[Company Hierarchy].&[10]
Parameter Label (It’s Name) = HQ
I want to type in “HQ” and generate report for “[Company].[Company Hierarchy].&[10]”
So, basically, I want to TYPE in label text and transform that somehow so ssrs would generate report for it’s value that matches MDX format [dim].[hierarchy].&[member]
It's kind of hard to explain but how would I go about setting up the parameter and how would I use that parameter for datasets?
Thank you
It is possible to use NameColumn in SSAS.
If you properly set up your Company dimension, you will be able to reach your dimension via its name and not via its key.
[Company].[Company Hierarchy].&[10] (that's the way you get the dimension with the key 10. The key 10 is unique, returning only one member)
[Company].[Company Hierarchy].[HQ] (that's the way you get the dimension with its name. [HQ] in this example might not be unique. Notice that I don't use & this time.)

ReportViewer - how to filter on Multi Value Parameter

I have a report that uses a Multi Value parameter. I have added this to the report and can specify the parameter values in code.
Now I want to filter the data on the report by the multiple value parameter. Eg, I pass in a list of account no's and I want to filter the data on the report so only records with the passed in account no's are shown.
In the tablix properties there is a filters option which looks like the place I need to set up the filters.
I have added a new one, selected the Account Number column on the report. The operator that seems relevant to me is the 'in' operator. So show records that a 'in' this list. However, If i select the 'in' filter the expression text box is disabled. Is this what im meant to use?
Found it:
You should filter on The name of the parameter rather than an expression.
eg:
[#CostCentres]
rather than:
=Parameters!CostCentres.Value

Resources