January 15, 2008, 11:01 AM
Tim JLimit Display of Across Columns but include all records
I have a report that list Customers and places an 'X' in an Across Column under each Order Type this customer uses.
To show an example, using the CAR file, this report will show each COUNTRY and what BODYTYPE it makes:
DEFINE FILE CAR
BODY_X/A1 = IF CAR.BODY.BODYTYPE EQ CAR.BODY.BODYTYPE THEN 'X' ELSE '';
END
TABLE FILE CAR
SUM BODY_X
BY CAR.ORIGIN.COUNTRY
ACROSS CAR.BODY.BODYTYPE
ON TABLE SET HTMLCSS ON
ON TABLE NOTOTAL
END
What I need, still using the CAR file as an example, is to only include some of the Across Values (ex. ACROSS CAR.BODY.BODYTYPE COLUMNS COUPE AND HARDTOP AND ROADSTER).
When I do this, it only shows the Countries that make those body types. Even though FRANCE, W GERMANY and JAPAN do not make one of those BODYTYPES, I would still like to display a country record, but an 'X' would not appear under any of the columns.
Any help would be appreciated!
Thanks,
Tim J
January 15, 2008, 01:32 PM
GinnyJakesThis is really kludgy but ...
Run your fex and hold the output in a Focus file, index COUNTRY. Run another query just to get the countries. Join together with SET ALL=ON.
I'm sure someone else has a more clever idea.
January 16, 2008, 03:31 AM
Alan BAnother (kludgy) take on this is:
APP HOLD myApp
SET ASNAMES=ON
DEFINE FILE CAR
BODY_X/A20 = IF CAR.BODY.BODYTYPE EQ CAR.BODY.BODYTYPE THEN CAR.BODY.BODYTYPE ELSE '';
END
TABLE FILE CAR
SUM BODY_X
BY CAR.ORIGIN.COUNTRY
ACROSS CAR.BODY.BODYTYPE
ON TABLE HOLD
END
TABLE FILE HOLD
SUM
COMPUTE COUPE/A1 = IF BODCOUPE NE ' ' THEN 'X' ELSE ' ';
COMPUTE HARDTOP/A1 = IF BODHARDTOP NE ' ' THEN 'X' ELSE ' ';
COMPUTE ROADSTER/A1 = IF BODROADSTER NE ' ' THEN 'X' ELSE ' ';
BY COUNTRY
ON TABLE SET HTMLCSS ON
ON TABLE NOTOTAL
END
January 16, 2008, 05:06 AM
GamPAnd yet another, maybe even more clumsy, approach might be touse the BY ROWS OVER tactic.
Example with the car database:
DEFINE FILE CAR
BODY_X/A1 = IF CAR.BODY.BODYTYPE EQ CAR.BODY.BODYTYPE THEN 'X' ELSE '';
END
TABLE FILE CAR
SUM BODY_X
BY CAR.ORIGIN.COUNTRY ROWS 'ENGLAND' OVER 'FRANCE' OVER 'ITALY' OVER 'JAPAN' OVER 'W GERMANY'
ACROSS CAR.BODY.BODYTYPE COLUMNS COUPE AND HARDTOP AND ROADSTER
ON TABLE SET HTMLCSS ON
ON TABLE NOTOTAL
END
Hope this helps...
January 23, 2008, 11:41 AM
Tim JGinny, Alan and GamP. Thank you for your suggestions! These do the trick (kludgy or not!).
Thank You!
Tim J