SSRS Report Parameter Available Values setting - reporting-services

I am trying to set Available Values on SSRS Report Parameter properties.
I wish I can add some images but I do not enough reputation.
When I select 'Get values from a query', I don't have problem.
However, I get this message when I am trying to use 'Specify values'
"Field cannot be used in report parameter expressions."
I am using following expression. Any help would be appreciated.
=First(Fields!EventCode1.Value, "History2")

You cannot use the same dataset "History2" as a field (column in report design) and as well as in parameter list. Create a different dataset with the required value and use that in parameter.

Related

Display Parameter in SSRS Report

When a user runs the report, they can select a multi-value parameter. I know I can use Parameters!Value.Label(0), Parameters!Value.Label(1), etc to display the each of the values based on their location within the array, but the number of the values changes based on how many values the user selects.
The report separates each value onto a separate page. I'm looking to (a) have an expression that identifies which value's info is displayed on the page, and (b) an expression that labels the tab as the value when the report is exported to Excel. I expect the same expression would work for both.
I believe I should be using Array.IndexOf(Split(Parameters!Value.Label.ToString(), ","), Parameters!Client.Label), but just get #Error as the output when the report renders. I'm not sure, but it seems like the Array... expression would only identify the location within the array.
Could someone offer some insight into where the syntax is wrong? I'm not sure if the issue is syntax or it's an issue of how to specify which dataset to use in the expression.
Thanks.
This is what you should use
=Join(Parameters!CSR.Label, ", ")

Adding Fields into an expression in an SSRS 2008 report

Thank you in advance for taking your time to answer my question.
I am having trouble with expressions in the SSRS reporting system.
The Field I am adding required fields from the dataset I provided in the report, however when I try to preview the report I get the Following message:
"A Value expression used for the report parameter ‘Policies_Total’
refers to a field. Fields cannot be used in report parameter
expressions."
This is my expression:
=IIF(Sum(Fields!policy_id.Value, "DataSet1") Is Null, 0, Count(Sum(Fields!policy_id.Value, "DataSet1")))
That was suppoed to be converted from Crystal reports which has the following expression:
If IsNull ({usp_rep_agent_cases;1.policy_id}) then
0
Else
Count ({usp_rep_agent_cases;1.policy_id})
Any help is much appreciated.
Thank you
I think it may be as simple as understand that a 'parameter' should be passed into SSRS before fields are created for the most part. If this parameter is DEPENDENT on the value of something else first being chosen you cannot list it first as the field is not yet populated to my knowledge. It appears you are trying to use an expression to count something from a field from a dataset when you just make a dataset and reference that field directly. So instead of trying an expression you may choose a few other options instead:
Choose on the left pane of your parameter 'Available Values' selected 'Get values from a query'. You may use your query which is a 'dataset', value is self explanatory, label is what the end user will see display.
The option 'Allow null' value will accept a null value
You may run into situations where multiple datasets may need to be used, multiple selects or querying objects. In my experience with SSRS it gets mad at times when you try to reference a dataset used to display data with a dataset used to determine an event or action. SSRS also gets relativity slower the more Expressions you do so doing a whole report with nothing but expressions versus taking the power of the built ins of the RDL language is not really worth it IMHO.
For SSRS expressions you need to use IsNothing for NULL checking, something like:
=IIF(
IsNothing(Sum(Fields!policy_id.Value, "DataSet1"))
, 0
, Count(Sum(Fields!policy_id.Value, "DataSet1"))
)
In fact the whole expression seems a bit odd; what are you specifically trying to achieve with your expression? Are you just trying to count non-null values?
=Sum(IIf(IsNothing(Fields!policy_id.Value), 1, 0), "DataSet1")
Also, your error seems to be saying that a parameter is referencing a field when this isn't allowed, which may not be solved by changing syntax; I think more information about what you're trying to achieve is required here.

SSRS: Can I know if user selected "ALL" in multivalued param?

Customer wants me to repeat the parameter values in the page header of the report. But if they just choose "Select All" on a multi-valued parameter, they want the text "Any" listed.
For example, one parameter has a fixed set of 9 values. I hard-coded the expression for a text box to:
="Room Size: " &
iif(Parameters!pRoomCap.Count=9,
"Any",
Join(Parameters!pRoomCap.Value, ", "))
How can I do this if the parameter source is a query of unknown size?
Try this out. You need to compare the total number of parameters in the dataset to the count of selected parameters. The following assumes that your multivalue parameter is using a dataset called "dsRoomSizes"
="Room Size: "
& iif(Parameters!pRoomCap.Count = count(Fields!pRoomCap.Value,"dsRoomSizes"),
"Any",
Join(Parameters!pRoomCap.Value, ", "))
This expression will work in the page header/footer.
UPDATE
In the interests of finding a solution to your problem, the following should work for you. It feels hackish and I encourage you to keep research alternative methods but this will work:
Create a second multivalue parameter and name it something like "pRoomCap_hidden".
The source of the parameter is the exact same query
In the parameter properties, setting the default values to the same query
Important: Set the parameter visibility to hidden
This will create a second multivalue parameter in your report that is exactly the same as your initial multivalue parameter only this parameter list will have all values selected by default.
Enter the following expression in a textbox in your header:
=IIF(Parameters!pRoomCap.Count = Parameters!pRoomCap_hidden.Count,"All",Join(Parameters!ReportParameter1.Value,", "))
The above will compare the selected values in each parameter list. If the lists contain the same selected values then that indicates that "All" have been selected in the first list.
Like I said, it is hackish but it definitely works. Until you are upgraded to 2008, this might not be a bad workaround for you.
Can you compare the count of the parameter to the count of the dataset you pull the parameter values from?
I unioned my dataset for the parameters with one which I created manually with a "select" statement - I was then able to force the value to be something like -1 or null.
Then simply check if the parameter contains -1 or null and replace the value in the header with the replacement text.
BTW- I am now using SSRS 2008 R2 and this solution worked for me. My report uses three datasets; but only one in the tabilx that I needed to hide a row in. After long hours of searching and many, many, many unhelpful for wrong answers; the solution of creating a identical parameter only hidden (I marked it as internal) and then comparing to the exposed one is brilliant and easy.
Thank you very much!

Passing values for multi-value parameter in SSRS query string

I have two reports built using SSRS 2005. The first report is set to navigate to the second when a specific field is clicked.
There is a multi-value parameter on the second report. I need to pass multiple values for this parameter in the "Jump to Report" string when calling this report. Is there a way to pass multiple values? I have tried Field.Value but that doesn't work for multivalue, it wants Field.Value(0). Or can you pass a parameter that will cause the Select All value to be selected?
I figured it out. Looks like one of the parameters being passed in was Field.Value(0) instead of Field.Value. That was messing things up.

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.