Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS SQL Reporting format error

Posted on 2009-03-31
4
Medium Priority
?
535 Views
Last Modified: 2012-06-27
Here is the format:

=format(cdec(Fields!SSN.Value), "###-##-####")

Error if the value is " ".  How to check before convert this field value to decimal?
0
Comment
Question by:monica73174
  • 2
  • 2
4 Comments
 
LVL 25

Expert Comment

by:reb73
ID: 24031264
You should be able to use the ISNUMERIC function to check if the value is a number -

= IIF(IsNumeric(Fields!SSN.Value), format(cdec(Fields!SSN.Value), "###-##-####"), Fields!SSN.Value)
0
 

Author Comment

by:monica73174
ID: 24031427
still has error:
Here is the code:

=IIF(IsNumeric(Fields!SPOUSE_SSN.Value),format(cdec(Fields!SPOUSE_SSN.Value), "###-##-####"), Fields!SPOUSE_SSN.Value)

Error show in the field:  #Error

Warning message:
[rsRuntimeErrorInExpression] The Value expression for the textbox SPOUSE_SSN contains an error: Conversion from string "" to type 'Decimal' is not valid.
Preview complete -- 0 errors, 1 warnings



0
 
LVL 25

Accepted Solution

by:
reb73 earned 2000 total points
ID: 24031945
Try using VAL() instead of CDEC()
0
 

Author Comment

by:monica73174
ID: 24032093
It works.  Thank you very much for your help!!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by Valentino Vranken. Introduction: In a previous article (http://www.experts-exchange.com/articles/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Reporting-On-Data-From-Stored-Procedures-part-1.html) I announced that I would writ…
How to use Variables  and Custom code in SSRS report and Assembly reference to use compile shared code in SSRS. Its big question for all who are working with SSRS. It is easy to create assembly and refer in SSRS report, still there are some steps…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question