Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Butterflying' the Table 2

Status
Not open for further replies.

NewToCR

Programmer
Oct 20, 2005
54
US
I am pretty sure all of my CR writing will have one common thing. I have to 'butterfly' my tables.

Customer Cus_Type RepName CoName Address
'I' for Individuals
'C' for Companies


So I will have to pull information from the same table where Customer 'I' will be Representative for the Customer 'C' who is Company. They will have Address(if'C') and Names(if'I') etc.

So how am I suppose to deal with this? Please, advise.
 
I still have no idea what butterflying means. Please elaborate. They do not charge by the word here at tek-tips.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
HAHAHA...I thought I did, sorry.

I have to take 1 table and select all records where Cus_type = 'I'. It will fill this portion of the Report:
_______________________________________________________
Customer Cus_Type RepName CoName Address
ABC I Ab,Deb
ABD I Do,Boe
_______________________________________________________
To fill the rest of the Report I need to pull all records where Cus_type = 'C'. It will fill this portion of the Report:
______________________________________________________
Customer Cus_Type RepName CoNam Address
C XY 200 Anywhere
C XX 123 Anywhere
________________________________________________________
Both of these should form this:
______________________________________________________
Customer Cus_Type RepName CoName Address
ABC I,C Ad, Deb XY 200 Anywhere
ABD I,C Do, Boe XX 123 Anywhere
______________________________________________________
where Cus_Type column shown just as illustration, shouldn't be included.

So story is that this Rep works for this Company and all of them stored in the same table under Primary_ID. So joined by Primary_ID those will have to be pulled.

I hope I clarified it. Thanks
 
Hi,
If I understand what you want/need to do, you can link the table to itself by the Primary_ID and
then select all the fields you need:

Customer and Rep_Name from the first instance of the table and co_name and address from the aliased second instance of the table.( You can specify the different selection criteria for each of the table instances )

All this assumes that a common field links I types to C types







[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
This is what I need to do, right but I had never linked table to itself. What is procedure looks like? Thanks
 
In the database expert, add the table again to the report. Crystal will create an alias (a different name) for the report. Then, just join the two tables.

hth,
- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top