Answered How to display NULL date substitution?

  • Friday, November 16, 2012 5:20 PM
     
      Has Code

    I am building an SSRS 2008 R2 RDL file with a simple text box.  I have this expression:

    =Fields!PayerPlan.Value & " active between " & Fields!CoverageStartDate.Value & " and " & iif(IsNothing(Fields!CoverageEndDate.Value)=1,"Present",Fields!CoverageEndDate.Value)

    So this works if there is an end date.  But where there is a NULL end date, it just displays a blank space where the end date should occur.  How do I get it to display "Present" instead?  I also tried changing this expression to iif(CoverageEndDate = "", "Present", CoverageEndDate), but this expression only works where EndDate is actually NULL.  If EndDate is not NULL, it displays "#Error".


    Ryan D

All Replies

  • Friday, November 16, 2012 5:30 PM
     
     Answered Has Code

    Try this:

    =Fields!PayerPlan.Value & " active between " & Fields!CoverageStartDate.Value & " and " & iif(IsNothing(Fields!CoverageEndDate.Value),"Present",Fields!CoverageEndDate.Value)


    Shahfaisal Muhammed http://shahfaisalmuhammed.blogspot.com

    • Marked As Answer by ironryan77 Friday, November 16, 2012 7:07 PM
    •  
  • Friday, November 16, 2012 5:39 PM
     
     

    Just to add Shahfaisal's response ,you can try checking both null and "" condition as follows

    Fields!PayerPlan.Value & " active between " & Fields!CoverageStartDate.Value & " and " & iif(IsNothing(Fields!CoverageEndDate.Value),"Present",IIF(Fields!CoverageEndDate.Value="","Present",Fields!CoverageEndDate.Value))


    Gaur

  • Friday, November 16, 2012 5:44 PM
     
     
    Gaur, that still gives me the "#Error" message for cases where there is an end date

    Ryan D

  • Friday, November 16, 2012 5:45 PM
     
     
    Shahfaisal, this works!  Thanks!

    Ryan D

  • Friday, November 16, 2012 6:52 PM
     
     
    Shahfaisal, this works!  Thanks!

    Ryan D

    Would you mind marking the post as answer then as it resolved your issue?

    Shahfaisal Muhammed http://shahfaisalmuhammed.blogspot.com