0
votes

I want to show a textbox field, if the value is > 0. If the field is 0 (empty) the textbox should be hidden (or not visible).

I tried the following: -In the textbox field (PostageAndPacking) I selected Show or hide based on an epxression. And entered the following expression =IIF(String.IsNullOrEmpty(Fields!PostageAndPacking.Value), True, False)

But I received the error message: Der Hidden-Ausdruck für das Textfeld-Objekt 'PostageAndPacking' verweist auf das Feld 'PostageAndPacking'. Ein Ausdruck für ein Berichtselement kann nur auf Felder verweisen, die sich im aktuellen Datasetbereich oder, wenn der Ausdruck zu einer Aggregatfunktion gehört, im angegebenen Datasetbereich befinden.

What is wrong with my expression? Or what do I have to do to show/hide the field corresponding to the value?

Thanks!

1

1 Answers

0
votes

The problem is that Fields!PostageAndPacking.Value belongs to a data set in your report and there might be many values for it as the data set might have many records. So the question is which field from the rows of the data set you want to check the expression against.

Semantically, your data set might only have one row, but you still need to explicitly request the first element like this:

=Not(String.IsNullOrEmpty(First(Fields!PostageAndPacking.Value, "DataSet1")))

Assuming here that the name of your data set is DataSet1, the expression will show the TextBox if the first PostageAndPacking of the data has a value and it will hide it if PostageAndPacking is empty.

Note that you do not need to use IIF since String.IsNullOrEmpty() returns boolean.