Focal Point
[SOLVED]Conditionally suppress row-total when results have only one across column

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

April 27, 2015, 12:34 PM
BC_Chris
[SOLVED]Conditionally suppress row-total when results have only one across column
Hello all,

I have been searching for a way to mimic the "multilines" behavior that works for subtotals, and apply it to the row-total. What I'd like is for the row-total to appear if there is more than one across column showing on the report, but not appear when there is only one (which is what the multilines does for the subtotals).

I have seen some posts suggesting to count the number of selections made for the across column and use that to either include or not include the "ON TABLE ROW-TOTAL AS 'TOTAL'" line, but with my particular situation, the user could select more than one value, and the report might actually only contain one of those values in the results. I think I'll have to end up doing a hold file, but since I'm a newbie, I wonder if there is a more ninja way to do that?

I'm including a simple example using the car file:
TABLE FILE GA_CAR
PRINT
     GA_CAR.BODY.SEATS
BY  LOWEST GA_CAR.ORIGIN.COUNTRY
ACROSS LOWEST GA_CAR.BODY.BODYTYPE

ON GA_CAR.ORIGIN.COUNTRY SUBTOTAL MULTILINES AS '*TOTAL'
WHERE ( GA_CAR.ORIGIN.COUNTRY EQ &COUNTRY.(OR(FIND COUNTRY IN GA_CAR)).COUNTRY:. ) AND ( GA_CAR.BODY.BODYTYPE EQ &BODYTYPE.(OR(FIND BODYTYPE IN GA_CAR)).BODYTYPE. );
ON TABLE SET HTMLENCODE ON
ON TABLE SET EMPTYREPORT ON
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE ROW-TOTAL AS 'TOTAL'
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END  


If you run this nonsensical report and select England and France for the countries, and Convertible and Coupe for the body types, I'd like to suppress the row-total. If you select England and France for the countries, and Convertible and Sedan for the body types, then I'd like it to show up.

Does anybody know of a simple, straightforward way to do that?

Thanks,
Chris

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


WebFOCUS 8.1.03
Excel, PDF, HTML, Active Reports
April 28, 2015, 01:43 PM
Doug
I think that your best bet is to count the number of selections made for the across column and use that to either include or not include the "ON TABLE ROW-TOTAL AS 'TOTAL'" line. Just do that using a preprocessing extraneous hold file using &LINES. It's simple and straight forward.

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




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
April 28, 2015, 07:14 PM
BC_Chris
I mentioned that with my particular situation, the report might only contain one of the selected values, even though they might choose four different options. So that alas is not a solution.

Any other ideas?

Thanks,
Chris


WebFOCUS 8.1.03
Excel, PDF, HTML, Active Reports
April 29, 2015, 02:06 AM
Dave
BC_Chris,

You could do something like this:

TABLE FILE CAR
   SUM SALES
   BY BODYTYPE
WHERE ....whatever your want...
ON TABLE HOLD AS DUMMY
END
-RUN

-SET &ROW_TOTAL = IF &LINES GT 1 THEN 'ON TABLE ROW-TOTAL AS ''TOTAL'' ELSE '';

TABLE FILE CAR
   SUM ...
   BY  ...
WHERE ....whatever your want...
ON TABLE NOTOTAL
&ROW_TOTAL
ON TABLE PCHOLD FORMAT HTML
END


Does that help?

Greets,
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
May 11, 2015, 03:11 PM
BC_Chris
Thanks, Guru Dave. That was my original thought, but I wanted to see if perhaps I was missing another method to do the same thing.

Chris


WebFOCUS 8.1.03
Excel, PDF, HTML, Active Reports