Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Complicated table linking Post Reply Post New Topic
Author Message
swmorgan
Newbie
Newbie


Joined: 22 Dec 2010
Location: United States
Online Status: Offline
Posts: 2
Quote swmorgan Replybullet Topic: Complicated table linking
    Posted: 22 Dec 2010 at 8:51am
I'm not sure if this can even be done, but if it can, I'm sure it involves SQL commands that are way over my head.

I'm using Crystal XI. I'm connecting an IPCC database (db_cra) and a Track_IT database (TRACKIT80_DATA2).

In db_cra, I have a field (ContactCallDetail.originatorDN) that contains the phone number for each call into our help desk (either as 7 digit Cisco numbers or normal 10 digit numbers, with no dashes)

In TRACKIT80_DATA2, I have a field (TIUSER.EMPLOYEE_ID) that contains Cisco numbers for our users that have them, and another field (TIUSER.PHONE) that contains normal phone numbers for users without Cisco numbers (this field DOES have dashes in the phone number).

I created a left outer join between ContactCallDetail.originatorDN and TIUSER.EMPLOYEE_ID, and that worked great. Now, when I check my call records, I can see the name of the person who called...but ONLY if they call using a Cisco number. So, here's where I get over my head.

Can I, first of all, link both TIUSER.EMPLOYEE_ID and TIUSER.PHONE to
ContactCallDetail.originatorDN, so if ContactCallDetail.originatorDN contains a 7 digit number, it will link to TIUSER.EMPLOYEE_ID , otherwise it will link to TIUSER.PHONE.

Now, to up the difficulty, TIUSER.PHONE contains dashes and ContactCallDetail.originatorDN does not. I suppose they could be linked according to the last 4 numbers in the field, but I'm not sure if that would work or how to even do it.

I like a challenge, but I'm swimming a bit deep for my level on this one. Anyone have some ideas to help me keep afloat?

Thanks!




IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Dec 2010 at 9:17am

you can use the TIUSER table twice and left outer join it to CONTACTCALLDETAIL both times (once on ID and once on phone)...

You would have to write a command as one version of the table to deal with your dashes issue (if you do not have rights to creating a stored proc or view in your db).
the command would essentially replace one of the TIUSER tables needed and create a new field that strips out the dashes so you can do your join
SELECT    *, REPLACE(PHONE, '-', '') AS Phone_Updated
FROM         TIUSER
 
then outer join this command on the Phone_updated field


Edited by DBlank - 22 Dec 2010 at 9:18am
IP IP Logged
swmorgan
Newbie
Newbie


Joined: 22 Dec 2010
Location: United States
Online Status: Offline
Posts: 2
Quote swmorgan Replybullet Posted: 22 Dec 2010 at 10:23am
I tried what you said and it worked perfectly! Thanks so much!
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.