Focal Point
Creating groups in a report from different tables
February 26, 2007, 06:51 AM
moxiCreating groups in a report from different tables
I need to create a report having one set of rows from one table and another set/group from other table, wherein the columns are same in both of the sets.
For Eg.
Category Avg Age Sex RatioStudents
House A 15 980
House B 11 850
House C 9 1011
Teachers
PGT 35 1024
TGT 46 998
wherein Students and Teachers are 2 tables and Avg Age and Sex Ratio are from yet other tables which can be related to both Student and Teacher with Foreigh keys.
Can some one please guide me in creating the same.
Thanks in Advance.
MAXI
February 26, 2007, 07:23 AM
FrankDutchwhich field in each of the tables could act as a join field?
if you do not have it, there might be an extra table that holds the link.
than you can create a join and run the report.
|
Frank |
| prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7 |
February 26, 2007, 07:31 AM
moxijoin field exists the problem is the display pattern
is this presentation possible? if yes how?
normally wen we use a join the columns are from different tables and the rows are not grouped as per the tables
MAXI
February 26, 2007, 07:55 AM
Alan BIf you want a PDF output, then the easiest way would be to use a COMPOUND report.
TABLE FILE ONE
request
ON TABLE PCHOLD FORMAT PDF OPEN NOBREAK
END
TABLE FILE TWO
request
ON TABLE PCHOLD FORMAT PDF CLOSE
END
Would this work for you?
Alan.
WF 7.705/8.007
February 26, 2007, 02:49 PM
Leahquote:
Category Avg Age Sex Ratio
Students
House A 15 980
House B 11 850
House C 9 1011
Teachers
PGT 35 1024
TGT 46 998
If compound will not suit your requirements, have you a way to distinguish the teachers and students. Create a sort key and then do a by on the key and create a subhead.
Leah
February 27, 2007, 05:55 AM
moxiAlan what you have proposed will work only for PDF outputs, whereas my primary interest is HTML.
can u please suggest smthing for an HTML output in groups in a single report from
different tablesI think sort and by is for a single table output formatting, if no can someone please elucidate.
MAXI
February 27, 2007, 07:23 AM
Jim_at_LMYou can always code two or more reports and include into the primary program that contains the HTML of the held reports. You can use or omit headings/foteings etc. with this method, and you can test each report independently. I hope this helps.
FEX NAME HERE: REPORT00
:
-INCLUDE REPORT01 < SQL SELECTs, HOLD, DEFINEs, TABLE, HOLD as HTML, STYLESHEET etc.
-INCLUDE REPORT02 < SQL SELECTs, HOLD, DEFINEs, TABLE, HOLD as HTML, STYLESHEET etc.
-*
-SET &BANG_NOGS00 = IF &RECORDS EQ 0 THEN '!IBI.FIL.NORECS;' ELSE ' ';
-*
:
-*
-HTMLFORM BEGIN
Weekly …. Report - . . .
!IBI.FIL.APPHEAD1;
!IBI.FIL.REPORT1 ;
&BANG_NOGS00
!IBI.FIL.REPORT2 ;
&BANG_NOGS00
-HTMLFORM END
-REPORT00_END
WebFOCUS 7.6.11, WINDOWS, HTML, PDF, EXCEL
February 27, 2007, 08:26 AM
Alan BI would work with a match file here then, like this.
DEFINE FILE CAR
MA/A30 = COUNTRY;
MB/A10 = 'COUNTRY';
MC/I8 = SALES;
END
DEFINE FILE EMPLOYEE
MA/A30 = LAST_NAME;
MB/A10 = 'LAST_NAME';
MD/I8 = CSAL;
END
MATCH FILE CAR
SUM MC
BY MB
BY MA
RUN
FILE EMPLOYEE
SUM MD
BY MB
BY MA
AFTER MATCH HOLD OLD-OR-NEW
END
DEFINE FILE HOLD
ME/I8 = IF MB EQ 'COUNTRY' THEN MC ELSE MD;
END
TABLE FILE HOLD
PRINT ME AS ' '
BY MB NOPRINT
ON MB SUBHEAD
"<MB"
BY MA AS ' '
END
Basically matching the fields from the 2 files. It obviously wants a bit of work your side to get teh right field names and neaten it up.
Alan.
WF 7.705/8.007
February 27, 2007, 08:33 AM
Danny-SRLHi Moxi,
You should use the MORE option of TABLE.
This is my assumption.
You have a STUDENT file with the following fields:
STUDENT_CAT AGE RATIO
You have a TEACHERS file with the following fields:
TEACHER_CAT AGE RATIO
DEFINE FILE STUDENT
CAT/.. = STUDENT_CAT;
END
DEFINE FILE TEACHERS
CAT/.. = TEACHER_CAT;
END
TABLE FILE STUDENT
PRINT AGE RATIO
BY CAT
MORE
FILE TEACHERS
END
You should get a single list with data from both files
Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF