Maeva
Maeva

Reputation: 25

Setvalue Display the first value that is not Zero

I use microsoft sql server report builder. I have a big sql query for the Presentation of my Report. i want to assign the output of one of the Columns to a textbox. the txbox should be displayed the first value of the table which is not zero.

I tried that First(Fields!name.Value, "V_Tabelle") .but if the first value is null, the textbox remains empty I tried that IIf(IsNothing(Fields!name.Value), "null", Fields!name.Value) , but i am receiving an error. field references outside a data area must be included in aggregate functions that specify a dataset area.

 First(Fields!name.Value, "V_Tabelle")
IIf(IsNothing(Fields!name.Value), "null", Fields!name.Value)

The value expression for the text field "Status6" refers directly to the field "name" without specifying a dataset aggregate. If the report contains multiple datasets, field references outside a data area must be included in aggregate functions that specify a dataset area.

Upvotes: 1

Views: 101

Answers (1)

Strawberryshrub
Strawberryshrub

Reputation: 3389

This way it checks if the first value is null, is this the case the text Empty will be displayed.

=IIF(First(Fields!YourField.Value, "DataSet1") = Nothing, 
     "Empty", 
     First(Fields!YourField.Value, "DataSet1")
     )

Upvotes: 1

Related Questions