I'm trying to Retrieve a value of a field, but that name of the field needs to be dynamic.
i.e.
=iif(Fields!Year1.Value = 1, 0, 1)
But I need the Year1
part to be returned from another dataset, so the Year1
is dynamic (could be Year2
, Year3
etc....)
I have a field that returns the data
=First(Fields!YearCount.Value, "YearColumn").
This expression in itself will return the Year1
, Year2
etc.. part, however I am struggling to concatenate this with the if statement.
I have tried:
=iif(Fields!(First(Fields!YearCount.Value, "YearColumn")).Value = 1, 0, 1)
for example.
The notation to reference a field in SSRS is either:
=Fields!FieldName
or then
=Fields(FieldName)
So in your case, try this:
=Fields(First(Fields!YearCount.Value, "YearColumn")).Value
because the inner function should return Year1
(or another value), you should get an expression like:
=Fields("Year1").Value
and that should give you your value you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With