Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: SSN data Formatting Post Reply Post New Topic
Author Message
trino
Newbie
Newbie
Avatar

Joined: 13 Apr 2010
Online Status: Offline
Posts: 14
Quote trino Replybullet Topic: SSN data Formatting
     Posted: 20 Apr 2010 at 8:33am

I am trying to compare social security numbers from two different databases and am having trouble matching them becuase one table has the socials with the dashes (111-11-1111) and the other does not (111111111).  Is there a way to easily remove the dashes or add them through a formula?  Are there any other options short of changing the databases?  Thank you!

 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Apr 2010 at 8:51am
to remove the '-' you can create a  formual field as
 
This will not help you join on that field though as you need to do make a change to the field before bringing it into crystal.
IP IP Logged
trino
Newbie
Newbie
Avatar

Joined: 13 Apr 2010
Online Status: Offline
Posts: 14
Quote trino Replybullet Posted: 20 Apr 2010 at 8:55am
That did exaclty what I needed!  Thank you so much!
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 20 Sep 2011 at 8:20am
I have the same issue.  Two different databases: one with the '-' in the ssn the other without.  I see how to use the replace in the formula, but how do I compare the fields before I bring it into Crystal Reports?  Or how do I join the two fields?
Thanks!
minnie_eye
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Sep 2011 at 11:05am
depedning on your source type and user rights you could use a view or stored proc to do the comparison.
In crystal you could also use a command to strip the "-"
IP IP Logged
trino
Newbie
Newbie
Avatar

Joined: 13 Apr 2010
Online Status: Offline
Posts: 14
Quote trino Replybullet Posted: 20 Sep 2011 at 11:08am
What I ended up doing was using a sub report and linking the formula field to the matching field.  
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 20 Sep 2011 at 11:27am
DBLANK, View and Stored Procedures are not an option for me.  By 'command to strip the "-" ' do you mean the Replace?  If so, how & when do you link the two ssn fields?
Trino,  The subreport is a good idea...  I'll try it.
 
Thanks for all the help!!
 
minnie_eye
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Sep 2011 at 11:34am
you can use a crystal command as your source (replacing for the table that has the dashes in the SSN).
When you go to add a table via the databse expert there is an Add Command option usually above the DB name. Double click it and it will open a screen to write your command.
When writing the command you can use a replace function to strip out the dashes.
Example:
select *, REPLACE(SSN, '-', '') AS SSN_2
from tablename
 
Now you can add the second table (the one without the dashes already) and join the table and command together on table.SSN = command.SSN_2


Edited by DBlank - 20 Sep 2011 at 11:37am
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 20 Sep 2011 at 12:42pm
DBLANK, Wonderful!  I just had to change the command a little.  I was getting an 'ORA-00923: FROM keyword not found where expected' error.  I changed the command to
select REPLACE (SSN, '-', '') AS SSN_2
from IND_TBLINDIVIDUAL
 
Thank you all for your help!
minnie_eye
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum