Mensaje
De
28/07/2003 15:33:54
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
 
 
a
28/07/2003 14:29:17
General information
Foro:
Visual FoxPro
Category:
Informes & Diseñador de informes
Miscellaneous
ID de la conversación:
00809019
ID del mensaje:
00814298
Views:
34
Hi Khan:
>
Thank you for your response.

>If you place the fields one in a row you can print a report. Is that you want ???
>
Right now, it prints in the order shown in the select statement. I just want the order changed. However, the concern is that SortKey 1 has the information that goes into the pager header of the report.
>>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
>>>
>>>
- Ravi

True greatness consists in being great in little things.
- Charles Simmons
Previous
Responder
Mapa
Ver