Search code examples
sqltextexpressionhideepicor

SQL server report builder show text box only if a field is blank


I have several text boxes that display information that the field cannot display.

Now when there is data in the field, I don't want the textboxes to display their extra information. Is there a visibility expression that makes it so the textboxes are only displayed if the field is blank or 0.00?

Edit: The text box ("TxtCycleTime13") expressions are: "=IIf((Fields!PartNum.Value Like "16THW-PIF"), "24.0", "0.00")" right now - This makes the text boxes display 24.0 whenever a part number starts with 16THW-PIF

The text box ("TxtCycleTime13") visibility expression are: "=Iif(ReportItems!TxtCycleTime13.Value = "0.00", True, False)" right now. - This makes the text box show ONLY if it has 24.0 (or in other words, if only the part number is 16THW-PIF)

Thanks!


Solution

  • True in the expression specifies Hidden, so if the expression returns true the text box will not show. To invert this you would simply swap the True and False:

    =Iif(ReportItems!TxtCycleTime13.Value = "0.00", False, True)
    

    This will only show the textbox if the value is 0. If you want to check a field instead of the existing textbox, just reference it instead;

    =Iif(Fields!CycleTime.Value = "0.00", False, True)