Click here to Skip to main content
12,898,174 members (67,801 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SSRS
Hello friends,
I'm getting LastActivityDate column from the stored procedure.
when i bind that column in SSRS report it gives error, if the column has no or null value.

I tried with following
=iif((Fields!LastActivityDate.Value = ""),"",format(cdate(Fields!LastActivityDate.Value),"dd-MM-yyyy"))


but it still not working, give #error when report is run for null values.

Any idea where I'm going wrong..?

Thanks in advance =)
Posted 27-Aug-12 0:03am
Updated 7-Mar-17 0:38am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

change to:
=iif((Fields!LastActivityDate.Value = Nothing),"",format(cdate(Fields!LastActivityDate.Value),"dd-MM-yyyy"))
  Permalink  
Comments
dhage.prashant01 27-Aug-12 6:56am
   
Still its giving the same error.. :(
Kuthuparakkal 27-Aug-12 7:02am
   
Make sure LastActivityDate conforms VBA datestring format:
Conversion Result
---------- ------
CDate("May 14 1977") 14/05/1977

CDate("14/May/1977") 14/05/1977

CDate("14/05/1977") 14/05/1977

CDate("05/14/1977") 14/05/1977

CDate(0) 12:00:00 AM

CDate(-1) 29/12/1899
dhage.prashant01 28-Aug-12 2:09am
   
i have handled the same in backend, its working fine.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Try:
=iif((Fields!LastActivityDate.Value Is Nothing),"No-Date", FORMAT(CDate(Fields!LastActivityDate.Value),"dd-MM-yyyy"))
  Permalink  
Comments
dhage.prashant01 27-Aug-12 7:23am
   
Still same issue
if i replace some other date field in
FORMAT(CDate(Fields!LastActivityDate.Value),"dd-MM-yyyy")

It works fine, but referring same field gives error.

Any idea, y so??
Sandeep Mewara 27-Aug-12 7:49am
   
Might be your 'this' date field is not null. Check the query what is being returned for the field.
dhage.prashant01 28-Aug-12 2:09am
   
i have handled the same in backend, its working fine.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

I have handled in query part of dataset itself and then binding it to report
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

=FORMAT(CDate(IIf(CSTR(Fields!EMP_REVISED_END_DATE.Value)="","1900-01-01",Fields!EMP_REVISED_END_DATE.Value)),"dd-MMM-yyyy"))
  Permalink  
Comments
Richard Deeming 27-Sep-16 15:14pm
   
Four years and one month late to the party, and your "solution" doesn't even match the question!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 7 Mar 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100