Match field value of parameter from the same dataset using ssrs - reporting-services

I have a dataset FiscalYearMonth which contains
Fiscalmonthyear
Fiscalmonthkey
I have also Parameters!FiscalYearMonth.Value
How can I get Fiscalmonthkey for FiscalYearMonth parameter ? I tried the following expression but didn't work
=lookup(Fields!FiscalMonthYear.Value,Parameters!FiscalYearMonth.Value, Fields!FiscalMonthKey.Value, "FiscalYearMonth")

I think you have your function parameters in the wrong order, try this:
=lookup(Parameters!FiscalYearMonth.Value, Fields!FiscalMonthYear.Value, Fields!FiscalMonthKey.Value, "FiscalYearMonth")
This bascially says "in the dataset 'FiscalYearMonth', compare the value of Parameters!FiscalYearMonth.Value to the field Fields!FiscalMonthYear.Value for each row in the dataset and return the value of Fields!FiscalMonthKey.Value where there is a match".
Note that the Lookup() function only returns a single value and will stop at the first match found.

Related

Why my parameter shows me an error Failed to evaluate the FilterValues of the DataSet?

I want to get available values from query in my ssrs report parameter.
I set Get values from a query
DataSet : name of my dataset#
Value field: my field
Label field : my field
To get an idea i will show you what i mean:
For expected results : I want to use my parameter as multie value parameter..
Your expression should be something like this and you need to add this expression by pressing fx next to value rather than directly adding it.
=IIF(Parameters!RootPoint.Value(0)="",Fields!C_RootPoint.Value,Parameters!RootPoint.Value(0))
also if you are trying to check if your first parameter value is null then you should try like below
=IIF(Isnothing(Parameters!RootPoint.Value(0)),Fields!C_RootPoint.Value,Parameters!RootPoint.Value(0))

How to filter a tablix based on paramater but no filter when paramater is null?

I've a tablix with data that comes from a dataset , there is a column called Productgroup and there might be some users that would like to apply a filter on it.
I'm trying to build an ssrs expression that will filter my tablix on that specific column but only when the parameter called #Filter is not null , if null , it does not need to apply filter
I've tried
Expression: Productgroup
Operator: like
Value: =IIF(IsNothing(Parameters!Filter.Value), false, Fields!ProductGroup=Parameters!Filter.Value)
Nothing seems to works :(
First of all, it's best to send your parameters to your dataset and filter on the server, rather than bring back ALL of the data and filter on the client side. So that means parameterizing your stored procedure, or using a WHERE clause to filter the table/view you're connecting to.
If you stick with this approach:
You want your Expression to be "ProductGroup".
You want your Operator to be "=".
You want your Value to be =IIF(IsNothing(Parameters!paramFilter.Value), Fields!Productgroup.Value, Parameters!paramFilter.Value)
What you're doing is saying if the parameter is empty, I need the ProductGroup to be equal to the ProductGroup. That's always true. But if the parameter is not empty, the ProductGroup has to be equal to the parameter value.

Passing a report variable to another expression

I'm trying to pass a report variable to an expression used to populate textbox but it's giving me syntax error. Here's the expression.
=Fields!Variables!col1.Value.Value
The variable (Variables!col1.Value) should return a fieldname that I want to use to populate a textbox inside a table.
Edit:
Basically I have a multi-value parameter that passes on to a stored procedure that pulls the data based on the parameter value. The first 4-5 columns returned are static while the rest are dynamic and can have unknown number of columns but I do know the max number of columns.
What I'm trying to do is to create a fixed number of columns and then show/hide them based on the parameter. I get the column title via an expression (=Parameters!Course_IDs.Label(0)) and then I want to use this value to create a textbox that will populate the column based on this value Course_IDs.Label(0).
Since it is a multi-valued parameter, you will likely need to join the results:
=JOIN(Parameters!ParameterName.Value, ", ")
If it is a variable from the dataset you will likely need to use LOOKUPSET() to get the values.
Also note that parameter values might be ugly to look at. In that case use the name instead - Parameters!ParameterName.Label

SSRS expression with missing column not working

I'm trying to create an expression with a missing column. as in the column is not returned from the query but does exist in the list of fields.
The problem I'm having is that every time I do an expression and one of the parameters is from a field that doesn't have a return from query the query fails silently. the following example is looking at a field "test" that, as I said, exists in the list of fields but is not returned from the query, how can I have this is statement send "alert"??
=IIF(Fields!test.IsMissing,"alert",Fields!test.Value)
The reason that I don't return the field is that the columns are dependent on the parameters I enter in the procedure (so they could be used or not depending on what the user is asking)
Thank you
From reading your question I think, you have dynamic columns which will be returns conditionally
So what you should do is,
1) Create the parameter in the parameter list and set it as the internal and assign the field value to that parameter, suppose the parameter is dyanmicfiledvalue
2) Change your expression as,
=IIF(IsNothing(Parameters!dyanmicfiledvalue.value),"alert", Parameters!dyanmicfiledvalue.value )
that should do it. Let me know in case of issues.
Or if you want to check null or empty value for that column just change as
=IIF(IsNothing(Fields!test.value),"alert",Fields!test.value)

SSRS multivalue parameter passing

I have a multi value parameter I get from a query. I pass it to my dataset and it works like a champ. The dataset parameter uses join, i.e., =JOIN(Parameters!CodeList.Value,",").
So far so good. However when I pass this to a subreport, the subreport seems to only "get" the first item in the list instead of the string.
Also, if I put a textbox on my main report that looks at the CodeList parameter, i.e., =Parameters!CodeList.Value(0), I just see the first item. Using JOIN here returns an error.
I clearly don't get something here. Any available illumination?:)
How about this ?
=Parameters!CodeList.Value(0) gives you the first selected parameter value
=Parameters!CodeList.Value(1) gives you the second selected parameter value
so on
&
Join(Parameters!CodeList.Value,",")
will give you the all selected value for the parameter seperated by ,
Condition is, parameter should exists lol'z.
Assuming that you want it to behave identically to your dataset in this report (I.E. you want to send a string containing all the values in your parameter separated by a comma), you just need to pass the same thing to the SubReport's parameter:
=JOIN(Parameters!CodeList.Value,",")
If what you actually want is for the Parameter in your SubReport to have the same values as the Parameter in your main report, you need to pass:
=Parameters!CodeList.Value
Note the absence of the (0) at the end. The (0) on the end of it will cause it to pass only the first value in the parameter which isn't what you're after.