CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008
    Posts
    12

    adding dashes back into the SSN

    I need to add dashes back to my Social Security Number field. The field is a string in my SQL table.
    When it comes into Crystal it comes out 123121234 but I want it to read 123-12-1234.

    Is there a formula for this?
    Crystal 8.5

    Thanks
    jake

  2. #2
    Join Date
    Apr 2008
    Location
    Pittsburgh
    Posts
    103

    Re: adding dashes back into the SSN

    You would need to parse the field and store the results into three different variables.

    start := left({field.name},3);
    mid := mid({field.name},4,2);
    end:= right({field.name},6);
    result := start & "-" & mid & "-" & end;

    May not be 100% correct since I don't have Crystal in front of me to test, but I use something close to this all of the time for phone numbers.

  3. #3
    Join Date
    Jul 2005
    Posts
    991

    Re: adding dashes back into the SSN

    Code:
    left({field.name},3) + "-" + mid({field.name},4,2) + "-" + right({field.name},6)

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts



HTML5 Development Center

Click Here to Expand Forum to Full Width