Reputation: 429
I'm editing a previous report and I want to add a Hidden expression to a new textbox and I'm using a simple switch statement to accomplish this goal.
=Switch(Fields!cptyLongName.Value="Homer City Generation, L.P.", FALSE, TRUE)
Then it underlines Fields!cptyLongName.Value and says its unknown. If i ignore it and try to preview the report it tells me: "The hidden expression for the text box 'Textbox1' contains an error: Argument 'VarExpr' is not a valid value."
The weird thing is that The same field is used elsewhere in the report as:
First(Fields!cptyLongName.Value)
And under the DataSet the field cptyLongName is present. I find it weird that when you try to put in an expression for anything under the Category 'Fields' it's not there. I've done a bit of reasearch and I know that using:
SomeMethod(Fields!SomeFieldName.Value, "SomeDatasetName")
Should work and fix the issues. Unfortunately it does not fix anything..This whole thing makes no sense to me because it pulls in data from the database in other parts of the report but whenever i edit something into it with the same details it refuses to work.
Upvotes: 0
Views: 1782
Reputation: 6669
Reason is the textbox is out of scope of the dataset. You must use First
or other aggregate function.
=iif(FIRST(Fields!cptyLongName.Value, "YourDataSetName")="Homer City Generation, L.P.", FALSE, TRUE)
Replace YourDataSetName
to the dataset related to cptyLongName
and put it in double quotes.
Upvotes: 3