Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to achieve multiple detail bands with columns?
Message
 
To
28/07/2003 14:24:03
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00809019
Message ID:
00814467
Views:
31
Sure. Just change the number used in the AS SORTKEY portion of the SELECT statement. For conditions use "1", for Medications use "2", and so on.

Cathy

>Hi Cathy:
>
>Is there a way of printing the results of the select statement in the following order:
>
>1. Conditions
>2. Medications
>3. Consultations
>4. Family History
>5. Past History
>6. Allergies
>
>Thanks.
>
>
>
>>Basically, you need to make each SELECT stmt have the same list of fields for each table so they can be UNIONed together. Try adjusting the SQL Statement to something like the following:
>>
>>
>>SELECT '1' AS SortKey, 'Family History' AS Group, ;
>>    demox AS Extra1, demoy AS Extra2, demoz AS Extra3, ;
>>    SomeDate AS Date1, SomeDate AS Date2, ;
>>    HealthNo, FamHist AS Descr, FROM TableA ;
>>  UNION SELECT '2' AS SortKey, 'Past History' AS Group, ;
>>    demox AS Extra1, demoy AS Extra2, demoz AS Extra3, ;
>>    SomeDate AS Date1, SomeDate AS Date2, ;
>>    HealthNo, PastHist AS Descr FROM TableA ;
>>  UNION SELECT '3' AS SortKey, 'Allergies' AS Group, ;
>>    demox AS Extra1, demoy AS Extra2, demoz AS Extra3, ;
>>    SomeDate AS Date1, SomeDate AS Date2, ;
>>    HealthNo, Allergy AS Descr FROM TableA ;
>>  UNION SELECT '4' AS SortKey, 'Conditions' AS Group, ;
>>    '' AS Extra1, '' AS Extra2, '' AS Extra3, ;
>>    RecordDate AS Date1, ResolvedDate AS Date2, ;
>>    HealthNo, Condition AS Descr FROM TableB ;
>>  UNION SELECT '5' AS SortKey, 'Regimans' AS Group, ;
>>    '' AS Extra1, '' AS Extra2, '' AS Extra3, ;
>>    StateDate AS Date1, EndDate AS Date2, ;
>>    HealthNo, Regiman AS Descr FROM TableC ;
>>  UNION SELECT '6' AS SortKey, 'Consultations' AS Group, ;
>>    '' AS Extra1, '' AS Extra2, '' AS Extra3, ;
>>    ReferDate AS Date1, {} AS Date2, ;
>>    HealthNo, Consult AS Descr FROM TableD ;
>>ORDER BY HealthNo, SortKey ;
>>INTO CURSOR TmpData
>>
>>
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform