Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grouping problem
Message
From
12/08/2008 02:52:57
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01338206
Message ID:
01338241
Views:
23
Let’s say that you have a cursor (table) “Z” that looks like this:
Side : Name : Attorney
------------------------------------------------------
"Defendant" "Amy Black" "Frank Smith"
"Defendant" "Amy Black" "Jim Daniels"
"Plaintiff" "Bob Bridge" "Julie Nagle"
"Defendant" "George Green" "Frank Smith"
"Defendant" "George Green" "Jim Daniels"
"Plaintiff" "Geri Randle" "Ben Bogle"
"Plaintiff" "Geri Randle" "John Doe"
"Plaintiff" "Geri Randle" "Nancy Golden"
"plaintiff" "Helen Bridge" "Julie Nagle"
"Plaintiff" "Henry Randle" "Ben Bogle"
"Plaintiff" "Henry Randle" "John Doe"
"Plaintiff" "Henry Randle" "Nancy Golden"
"Plaintiff" "Jennifer Randle" "Ben Bogle"
"Plaintiff" "Jennifer Randle" "John Doe"
"Plaintiff" "Jennifer Randle" "Nancy Golden"
"Defendant" "Mary French" "Henry Prince"
"Plaintiff" "Percy Wilson" "Ben Bogle"
"Plaintiff" "Percy Wilson" "John Doe"
"Plaintiff" "Percy Wilson" "Nancy Golden"
"Plaintiff" "Roger Randle" "Ben Bogle"
"Plaintiff" "Roger Randle" "John Doe"
"Plaintiff" "Roger Randle" "Nancy Golden"

I am assuming that you do not have separate files with just names of the “parties” and "attorneys". If you do you can change the code, but for now I will create distinct list of the “parties”.
SELECT DISTINCT side,name FROM z INTO CURSOR zPARTY
SELECT zPARTY.*,CAST("" as C(200)) as AssignAttorney FROM zparty INTO CURSOR zResult readwrite
INDEX ON name TAG z1

SELECT z
SET RELATION TO name INTO zResult 
SCAN
    REPLACE zResult.AssignAttorney WITH IIF(EMPTY(zResult.AssignAttorney ),ALLTRIM(z.AttorneyName) ,ALLTRIM(zResult.AssignAttorney )+", "+ALLTRIM(Z.AttorneyName) ) IN zResult 

ENDSCAN
SET RELATION TO
SELECT zResult
The result data will look like
Side Name AssignAttorney
---------------------------------------------------------------------------
"Defendant" "Amy Black" "Frank Smith, Jim Daniels"
"plaintiff" "Bob Bridge" "Julie Nagle"
"Defendant" "George Green" "Frank Smith, Jim Daniels"
"Plaintiff" "Geri Randle" "Ben Bogle, John Doe, Nancy Golden"
"plaintiff" "Helen Bridge" "Julie Nagle"
"Plaintiff" "Henry Randle" "Ben Bogle, John Doe, Nancy Golden"
"Plaintiff" "Jennifer Randle" "Ben Bogle, John Doe, Nancy Golden"
"Defendant" "Mary French" "Henry Prince"
"Plaintiff" "Percy Wilson" "Ben Bogle, John Doe, Nancy Golden"
"Plaintiff" "Roger Randle" "Ben Bogle, John Doe, Nancy Golden"
Now you can sort and group by "AssignAttorney" column.

It is way too late and I am sure there are better ways to do it, but maybe it’ll help.

Good luck. :)




>Sure. After the information about the case itself (the header), they want the Attorney and Party data to look like this:
>
>
>Attorney Julie Nagle
>---Plaintiff Bob Bridge
>---Plaintiff Helen Bridge
>
>Attorney Ben Bogle
>Attorney John Doe
>Attorney Nancy Golden
>---Plaintiff Roger Randle
>---Plaintiff Geri Randle
>---Plaintiff Jennifer Randle
>---Plaintiff Henry Randle
>---Plaintiff Percy Wilson
>
>Attorney Jim Daniels
>Attorney Frank Smith
>---Defendant Amy Black
>---Defendant George Green
>
>Attorney Henry Prince
>---Defendant Mary French
>
>For each Case, there is at least one Party on each side; each Party is represented by one or more Attorneys. The problems with the report formatting come when they share Attorneys.. The data structure doesn't really facilitate grouping them. The Case is the 'parent', the Party the 'child', and the Attorney the 'grandchild'--and 'grandchildren' can be (and are) entered multiple times.. In this example, there are 20 Attorney records, but only 7 distinct individuals.
Previous
Reply
Map
View

Click here to load this message in the networking platform