Search code examples
sql-serverssrs-2012

How to replace Datetime format to some text


I have one column to display status about the machine.

Now I want if the column is null, display END. Else, the column should display RUNNING.

The column is Datetime format. I don't know how to replace datetime. I already replaced all the null value to END.

But not for datetime format and replace two different format in same expression.

=IIF(isnothing(Fields!ENDTIME.Value),"END",Fields!ENDTIME.Value)

Solution

  • This is really as simple as it appears. IIf requires 3 parameters. The first is a boolean expression. The second is the value to be returned if the (previous) expression evaluated to TRUE, and the 3rd if it evaluated to FALSE. So replace Fields!ENDTIME.Value in your 3rd parameter with "RUNNING":

    =IIf(IsNothing(Fields!ENDTIME.Value),"END","RUNNING")