| Author |
Message |
bigjay2100
Newbie
Joined: 19 Feb 2014
Location: United States
Online Status: Offline
Posts: 1
|

Topic: Potentially Ugly Report to Create Posted: 19 Feb 2014 at 6:18am |
|
Ok, I have a potentially ugly Crystal Report I need to create.
Here is what I need. We are an Org/Ind association. We have several of our Org records that have secondary locations to them. We flag the primary location as RS_1 category type with an Org member type. Secondary's are flagged as RS_2 category type and an Org Member type. These records are stored in the same SQL table and are matched up as the RS_2 CO_ID field matches the RS_1 ID field.
We also have a key contact for each of our orgs and that person is listed as an IN_3. Again, this record is in the same table in SQL as the records listed above and this record is tied to the Org record on CO_ID of the IND record is equal to the ID of the ORG record.
I am trying to create a report that will show only the RS_1 records that have RS_2 records tied to them. I don't need to see any record that doesn't have an RS_2 record tied to it. I also need to show who the IN_3 record holder is for that Org in the same report.
So...Any ideas on how to accomplish this? I am relatively new to Crystal and can do pretty much every basic function but this seems much more complex. I think this can be done by creating formulas but I don't know how to code it using an IF-THEN-ELSE function where I say If Category = RS_1 then display XXXX else skip record.
Thanks.
Jayson
|
IP Logged |
|
|
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 20 Feb 2014 at 4:55am |
|
my standard answer, which may not apply to all, is to use a stored procedure as it will give you much more flexibility in manipulating your data.
for example, you can do a self join, not that you can't do this in CR, it's just probably simpler in a proc.
In Crystal you add the same table 2 times, and you would link them by the rs_2 id to the rs_2 co_id field...this will only give you records in one of the tables of the parent records, but you will also have duplicates in there are multiple rs_2 for the same rs_1.
HTH
|
IP Logged |
|
hello
Groupie
Joined: 05 Feb 2014
Online Status: Offline
Posts: 85
|

Posted: 21 Feb 2014 at 5:57am |
|
It sounds like you have a table with a header record for each organization followed by multiple detail records.
If that's the case, you will need to make multiple passes through the table to first get the header records processed, then do the detail records.
You could do a sub-report along with the main report, or the easier way would be to create multiple select statements in a stored procedure like lockwelle suggested.
|
IP Logged |
|
|
|