Focal Point
[SOLVED] Once more - totals split over two lines

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

February 12, 2008, 09:18 AM
GamP
[SOLVED] Once more - totals split over two lines
I know that there are many topics on this issue.
I have read them all. But I could not find one that would help me with my problem.
I have a simple table request, that has no by-fields, but which does have an ON TABLE COLUMN-TOTAL.
This total will be split up over two lines in all cases, no matter the length of the first field in the report.
Now, I need this unsorted output for my report, so sorting on the field is not an option. And I also need the column-totals.

The following is a solution for this situation, that will produce only 1 total line:
TABLE FILE CAR
PRINT
     CAR
     COUNTRY
     MODEL
     BODYTYPE
     SEATS
     DEALER_COST
     RETAIL_COST
     COMPUTE ORDFLD/I4 = ORDFLD + 1; NOPRINT
BY TOTAL COMPUTE NOPRINT
BY CAR
ON CAR COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     BORDER=LIGHT,
     FONT='ARIAL',
     SIZE=8,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
$
ENDSTYLE
END

The trick is in computing the sort-field, before sorting on it. That way you will keep the unsorted order that would have been generated without the BY's.

Hope this may also help someone else with the similar problem.

This message has been edited. Last edited by: FP Mod Chuck,


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 12, 2008, 10:47 AM
susannah
GamP, i tried your code, and i'm just not getting it...
Its coming out in alphabetical order BY CAR
and CAR is listed twice.
I don't see how the original file order remains unsorted.
ON CAR COLUMN-TOTAL doesn't seem to do anything, so i changed it to ON TABLE.
Can you clarify? i'm puzzled.

If i change it to this:

DEFINE FILE CAR
ORDFLD/I4 WITH CAR=ORDFLD + 1 ;
END
TABLE FILE CAR
PRINT
-*      CAR
     COUNTRY
     MODEL
     BODYTYPE
     SEATS
     DEALER_COST
     RETAIL_COST
-*COMPUTE ORDFLD/I4 = ORDFLD + 1;  
BY TOTAL ORDFLD NOPRINT
 BY CAR  
ON TABLE COLUMN-TOTAL AS 'TOTAL'

it seems to work ok and the records are in their original order.
And just dumping the records does result in a split total line. So both the original order field AND the a visible BY field (car) seem to be necessary to get this particular no-split total on an unsorted file.

This message has been edited. Last edited by: susannah,




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
February 13, 2008, 04:46 AM
GamP
Susannah,

I stand corrected.
Your remakrs are true, I was a little bit too anxious to get this recorded. Sorry about the confusion, and of course your bit of code is correct.
One additional remark though:
The total line will still split into two lines if the sort field is not long enough to accomodate the text used to identify the total. So if I were to specify
ON CAR COLUMN-TOTAL AS 'Total for the table'
it would still split. I would have to increase the size of the first visible by-column to prevent splitting.

Regards,


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 13, 2008, 12:39 PM
susannah
ah! i know just what you mean...




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
March 06, 2018, 11:51 PM
Joao
The solution to this issue can be found at link:https://www.informationbuilders.com/support/developers/how-display-report-totals-and-descriptions-same-line