1
votes

Here's an expression in the header of my report:

="Display value " & Lookup(Parameters!CycleID.Value, Fields!CycleID.Value, Fields!CycleDateDisplay.Value, "DSCycle")

CycleID and CycleDateDisplay are columns in the Dataset DSCycle. This works great in SSRS 2012, but when I try to upload the same report into SSRS 2008R2, I get this error:

The Value expression for the text box ‘Textbox5’ refers to the field ‘CycleID’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope. (rsFieldReference)

(and the same for CycleDateDisplay.)

I'm trying to figure out how to modify this expression to satisfy the "dataset scope" issue here. I consulted TechNet at http://technet.microsoft.com/en-us/library/cc879331%28v=sql.105%29.aspx and got this information:

To specify a scope parameter, provide the name of a dataset, data region, or group that is in scope for the report item. When a report has more than one dataset, an aggregate expression in a text box on the report body must specify a scope parameter. For example, =First(Fields!FieldName.Value, "DataSet1")

(emphasis added) Now is it possible that I can't use expressions of this kind in the header, since the TechNet text went out of its way to specify expressions on the report body? Or if I can, how do I specify columns from a dataset to be used in a LOOKUP() call?

Thank you!

1

1 Answers

4
votes

Very simple answer: The LOOKUP() function didn't exist until SSRS 2008 R2. If you try to use it in SSRS 2008 you will get this exact error.

I rewrote the report to include the CycleDateDisplay value in every line item instead of just showing it in the header. Problem solved.