Focal Point
[CLOSED]Dynamic NOBREAK?

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

May 13, 2016, 10:55 AM
rray9895
[CLOSED]Dynamic NOBREAK?
Hey guys, I'm running into a problem with a compound excel report. I have a part of my compound report that uses NOBREAK in order to group similar fexs on a single worksheet. Each of these fexs are identical except with a different WHERE clause. The report works great, but I run into a problem when the report is blank (i.e. there are no records that match the WHERE clause) because the NOBREAK will apply to the next fex (which is meant to remain on a separate worksheet)

Here is a CAR example to illustrate the problem:

APP PATH IBISAMP

-SET EMPTYREPORT = ON;

TABLE FILE CAR
PRINT
CNT.CAR
BY MODEL
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE PCHOLD FORMAT XLSX OPEN NOBREAK
END

TABLE FILE CAR
PRINT
CNT.CAR
BY MODEL
WHERE COUNTRY EQ 'FAKELAND'
ON TABLE PCHOLD FORMAT XLSX OPEN
END

TABLE FILE CAR
SUM
SEATS
BY COUNTRY
ON TABLE PCHOLD FORMAT XLSX OPEN
END

TABLE FILE CAR
SUM
SALES
BY MODEL
ON TABLE PCHOLD FORMAT XLSX CLOSE
END

If I had the WHERE clause in the second fex set to 'JAPAN' then the report would work as intended. But because there isn't a 'FAKELAND' value in the CAR file, the second fex doesn't populate, and the NOBREAK combines the "SEATS" fex (which is meant to be on a separate worksheet) with the initial fex. Reading through the Help file ("Creating a Compound Report") and searching through forums, I thought that adding a "SET EMPTYREPORT = ON" would address this issue, but it doesn't. Is there a method to dynamically turn off NOBREAK, if the subsequent fex doesn't have output?

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8.105M, Windows 10, App Studio
May 13, 2016, 11:07 AM
GavinL
You could put it in a temp hold validate record size, then TABLE FILE off the hold file with a NOBREAK if data exists.

Example:
APP PATH IBISAMP

-SET EMPTYREPORT = ON;

TABLE FILE CAR
PRINT CAR
BY MODEL
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE HOLD AS CAR1
END
-IF &LINES LE 0 THEN GOTO SKIPCAR1;

TABLE FILE CAR1
PRINT CNT.CAR
BY MODEL
ON TABLE PCHOLD FORMAT XLSX OPEN NOBREAK
END
-SKIPCAR1

TABLE FILE CAR
PRINT CAR
BY MODEL
WHERE COUNTRY EQ 'FAKELAND'
ON TABLE HOLD AS CAR2
END
-IF &LINES LE 0 THEN GOTO SKIPCAR2;

TABLE FILE CAR2
PRINT 
CNT.CAR
BY MODEL
ON TABLE PCHOLD FORMAT XLSX OPEN NOBREAK
END
-SKIPCAR2




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 13, 2016, 11:34 AM
rray9895
Gavin, thank you for your help. I don't really use the &LINES variable so it didn't even spring to mind.

I wanted to avoid adding anymore GOTO logic (the actual report I'm implementing this into has a ton of it, and it's getting out of hand), i was just hoping for a way to turn off NOBREAK.

I might have figured a workaround though. I tried putting in a small fex right after all of the reports I want combined into one worksheet. The values are NOPRINT, so nothing actually displays but having it there switches NOBREAK "off".

APP PATH IBISAMP

-SET EMPTYREPORT = ON;

TABLE FILE CAR
PRINT
CNT.CAR
BY MODEL
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE PCHOLD FORMAT XLSX OPEN NOBREAK
END

TABLE FILE CAR
PRINT
CNT.CAR
BY MODEL
WHERE COUNTRY EQ 'FAKELAND'
ON TABLE PCHOLD FORMAT XLSX OPEN NOBREAK
END
-* Added this to switch NOBREAK OFF.
TABLE FILE CAR
PRINT
CNT.CAR NOPRINT
BY MODEL NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE PCHOLD FORMAT XLSX OPEN
END

TABLE FILE CAR
SUM
SEATS
BY COUNTRY
ON TABLE PCHOLD FORMAT XLSX OPEN
END

TABLE FILE CAR
SUM
SALES
BY MODEL
ON TABLE PCHOLD FORMAT XLSX CLOSE
END


WebFOCUS 8.105M, Windows 10, App Studio
May 13, 2016, 02:34 PM
GavinL
don't know if it will work, but have you trying using SET COMPOUND in between the TABLE FILE?

SET COMPOUND=CLOSE

OPEN
Is specified with the first report, and begins the concatenation process. A report that contains the OPEN attribute must be PDF or PS format.

CLOSE
Is specified with the last report, and ends the concatenation process.

NOBREAK
Is an optional phrase that suppresses page breaks. By default, each report is displayed on a separate page.
You can use NOBREAK selectively in a request to control which reports are displayed on the same page.




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server