March 02, 2005, 03:37 PM
Pam Krattcolumn headings
I want my column heading to change depending on the data. Is there a way to do this without doing a compound report?
I currently have it working by using a subhead but if my report goes to a 2nd page, the original column headings appear and I want the subheading to appear instead of the column headings since the data at the point is my indices information.
My data_type is either category information (A) or indices information (I). My description field should be called category if my data_type eq 'A' or it should be called indices if my data_type eq 'I'.
My category information appears first so I have
table file car
print description as 'category'
marketvalue as 'market value'
pct.marketvalue as '% of total'
end
My columns for category information are:
category market value % of total
and for indices information:
indices market value % of total
I tried putting an if statement in my print and changing the column heading depending on data_type but that didn't work.
Any suggestions?
March 02, 2005, 06:51 PM
RBtry this
-set &heading/a8= if description eq 'a' then 'category' else if description eq 'i' then 'indices';
table file car
print description as '&heading'
marketvalue as 'market value'
pct.marketvalue as '% of total'
end
March 02, 2005, 07:00 PM
<Pietro De Santis>Unfotunately, that's not going to work.
1) You cannot have a field format in a -SET command.
2) I don't think this can be done, you cannot base the AS statement on the data being printed on the report.
March 02, 2005, 07:32 PM
LeahWanting to try something of course the CAR file doesn't have the fields, but I did some playing, of course this doesn't line up well in HTML nor excel, but:
-*just so I could force a page - break
SET LINES = 14
SET STYLEMODE = FIXED
DEFINE FILE CAR
COUNTEX/I2 WITH MODEL = (COUNTEX + 1);
REM/I1 WITH MODEL = IMOD ( COUNTEX, 2, REM );
DESCRIPTION/A1 WITH MODEL = IF REM EQ 0 THEN 'A' ELSE 'I';
MARKETVALUE/D12.2 = RETAIL_COST;
HEADMARK/A10 WITH MODEL = IF DESCRIPTION EQ 'A' THEN 'CATEGORY' ELSE 'INDICES';
END
TABLE FILE CAR
HEADING
"<HEADMARK MARKET VALUE % OF TOTAL PAGE: <TABPAGENO"
" "
PRINT DESCRIPTION AS ''
MARKETVALUE AS ''
PCT.MARKETVALUE AS ''
BY DESCRIPTION NOPRINT
ON DESCRIPTION
*-put in so if you don't page-break on the indices you will get the title change
SUBHEAD
" "
"INDICES MARKET VALUE % OF TOTAL"
" "
WHEN DESCRIPTION EQ 'I' AND TABPAGENO GT 1
END
March 02, 2005, 07:33 PM
LeahON my last post should most likely not have left the tabpageno in it.
March 04, 2005, 05:29 PM
susannahthis works like a charm(i'm in 525):
-SET &HDCOST = IF &WHICHCOST EQ 'STCOS' THEN 'Standard Cost' ELSE 'Actual Cost';
...
then in your code, not only the &var as a header but also a mouseover with info ( a bonus).
COST AS '<span title="Units * STSOC or STACC "> &HDCOST *,(d)</span>'
key is to make sure your &HDCOST header thing is separated by a blank before and after when you stick it in your AS phrase.