Focal Point
Comma in Column Title when using ACROSS and COMPUTE

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8001088331

July 18, 2005, 03:36 PM
Francis Mariani
Comma in Column Title when using ACROSS and COMPUTE
Why does the comma in the column title of the compute statement not work?

TABLE FILE CAR
SUM
SALES AS ''
DCOST NOPRINT
BY COUNTRY
ACROSS SEATS AS ''
COMPUTE TOT_COST/D15 = DCOST; AS 'TOTAL,COST'
END
July 18, 2005, 03:43 PM
Prarie
One of my co-workers opened a case with IBI on this topic...this is the answer he got:

That is because there is a restriction that states that only ONE line
of text is supported with an ACROSS.
You would have to do someting line suppress the default title with
SUM/PRINT field AS ''(two single quotes, next to each other) and then
do a -- ON TABLE SUBHEAD, and basically create your own Heading -- but then
youwould have to make sure to align everythig in it, since you are also
styling the report.
July 18, 2005, 03:51 PM
Francis Mariani
Prarie22,

Thanks for the information. Unfortunately, as you mention, creating column titles in heading or subheading lines is not a great solution, alignment is a big problem when the report can run for multiple formats.

Cheers.
July 18, 2005, 03:53 PM
Tony A
"A comma within a FIELD TITLE automatically generates a carriage return. This is
standard behavior that cannot be surpressed."

Yeah right, sounds to me like a bug that was "erradicated" in 4.3.5 has crept back in again!
July 18, 2005, 05:07 PM
mgrackin
I'm going to make a LOGICAL guess as to why this behavior is true and also give you a suggestion.

Due to the fact that the VALUES of the ACROSS field are used for the TITLES, the changing of a comma to a line break is not done. This makes sense since FOCUS has no idea if the VALUEs will contain commas, how many commas there might be in the VALUEs (there is a limit of 4 commas for a TITLE) and whether or not a user would want them converted to a line break. Even though the AS phrase text appears in the TITLE for the computed field, the disabling of the comma-to-line-break conversion propagates across (no pun intended) the entire "row" of ACROSS TITLEs. Is this a bug or an unforeseen issue yet to be addressed in a patch/release? I do not know because I have not seen this before.

Now for the suggested solution. IF your intended output format is HTML then change the AS 'TOTAL,COST' text to AS 'TOTAL<br>COST'. If you did not know, <br> is the HTML tag for a line break.

I hope this helps.
July 18, 2005, 06:38 PM
susannah
I second mickey's suggestion. that works!
July 18, 2005, 06:40 PM
Francis Mariani
The problem is that I have the same report running with three different formats: HTML, PDF and Excel 2000.
July 25, 2005, 08:32 PM
FocWizard
Mickey has the right idea. A COMPUTE after an ACROSS creates (internally) another value for the ACROSS field. Since a VALUE can't span multiple lines, the COMPUTEd column title can't either.
July 26, 2005, 04:12 PM
Francis Mariani
Or I could do it this way:

TABLE FILE CAR
SUM
COMPUTE TOT_COST/D15 = DCOST; AS 'TOTAL,COST'
BY COUNTRY
SUM
SALES AS ''
BY COUNTRY
ACROSS SEATS AS ''
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=TOT_COST, SEQUENCE=99, $
ENDSTYLE
END
July 26, 2005, 05:08 PM
mgrackin
Nice job, Francis. That does the trick.

Back to your original post that started this all, I am perplexed as to why the COMPUTE in your original post gave you one column on the right instead of a column for each ACROSS value. If you move the COMPUTE statement above the BY COUNTRY phrase it then creates a TOT_COST for each SEATS value. Is this supposed to work this way? Is the COMPUTE that appears AFTER the ACROSS phrase treated like an ON TABLE action in some way, kinda like a ROW-TOTAL? Can anyone shed some light on this? Did anyone else find this strange or did I miss an enhancement to the FOCUS language somewhere along the way? Thanks!
July 27, 2005, 12:06 AM
N.Selph
COMPUTEs after the ACROSS did get added somewhere along the way. (I'm pretty sure I couldn't do that in 4.3.6.) I don't know when it came in, but its here by 5.21. It is put on the end just like a rowtotal is.