MS SQL Reporting format error

Here is the format:

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

Error if the value is " ".  How to check before convert this field value to decimal?
monica73174Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
reb73Connect With a Mentor Commented:
Try using VAL() instead of CDEC()
0
 
reb73Commented:
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
 
monica73174Author Commented:
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
 
monica73174Author Commented:
It works.  Thank you very much for your help!!!
0
All Courses

From novice to tech pro — start learning today.