February 21, 2008, 02:00 AM
prash.cpmultiple items in a single row in header of report
HI,
I have the following requirement in report
I have a table Emp, with columns EmpID, Name, Salary, Dept and country
The header of the report includes
----this is header of report
Dept ID: D222
Country: A, B, C, D
------------
------this is Body of the report:
Empid Name Salary
111 ABC 1000
101 www 2000
I want all the countries to which different employees belong to in a single dept to be displayed in the header ( in this example country);
Thanks!
February 21, 2008, 03:24 AM
Tony APrash,
You would porbably need to double pass the data soemthing like this -
TABLE FILE CAR
PRINT COMPUTE CTRY_LIST/A500V = IF SEATS NE LAST SEATS THEN COUNTRY ELSE
IF COUNTRY EQ LAST COUNTRY THEN CTRY_LIST ELSE
CTRY_LIST || ', ' | COUNTRY;
BY SEATS
ON TABLE HOLD AS CTRYSEATS
END
TABLE FILE CTRYSEATS
SUM CTRY_LIST
BY SEATS
ON SEATS SUBHEAD
"Countrys with <MAX.SEATS Seated Cars <CTRY_LIST"
END
The IF ... THEN ... ELSE are required owing to the way the data is stored in the CAR file. You will have to understand your data structure to determine what I.T.E. combination you will need to build your list.
T
February 21, 2008, 03:40 AM
GamPOr, almost the same as Tony's solution, but then with the empdata file (which looks a bit more like your example):
TABLE FILE EMPDATA
PRINT PIN LASTNAME SALARY
COMPUTE DIVFLD/A1000V = IF DEPT NE LAST DEPT THEN DIV ELSE
IF DIV EQ LAST DIV THEN DIVFLD ELSE DIVFLD || (', ' | DIV);
BY DEPT
BY DIV
ON TABLE HOLD FORMAT ALPHA
END
TABLE FILE HOLD
SUM MAX.DIVFLD NOPRINT
BY DEPT
PRINT PIN LASTNAME SALARY
BY DEPT PAGE-BREAK
BY DIV
HEADING
"Department: <DEPT"
"Divisions: <MAX.DIVFLD"
END
Hope this helps ...