Focal Point
SOLVED......multiple headings and loop

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

September 15, 2014, 09:42 AM
djackson
SOLVED......multiple headings and loop
Hi,

I'd like to have the heading change to the right heading based on the country code in the following fex. I'm thinking it must have to loop through the records, and pick up the correct heading by using the GOTO's??

TABLE FILE CAR
SUM
SEATS
BY COUNTRY
BY MODEL
ON COUNTRY PAGE-BREAK

-IF COUNTRY IS 'FRANCE' THEN GOTO HEADING2 ELSE IF COUNTRY NE 'FRANCE' THEN GOTO NOTFRANCE;
-NOTFRANCE
HEADING
"This should be the heading for countries other than France"
-GOTO FINISHUP
-HEADING2
HEADING
"FRANCE"
-FINISHUP
ON TABLE PCHOLD FORMAT PDF
END

Hopefully pretty basic stuff?? Would appreciate any suggestions or direction!
thanks, Donna

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


Dev Studio 8.1.0.4, App Studio 8.1.5m, Reporting Server 8.1.4, InfoAssist, Active Technologies, Windows 2003 Server, Windows7
September 15, 2014, 10:08 AM
MartinY
DEFINE FILE CAR
TITLE /A70V = IF COUNTRY EQ 'FRANCE' THEN 'This should be the heading for France' ELSE 'This should be the heading for countries other than France: ' | COUNTRY;
END
TABLE FILE CAR
SUM
 SEATS
BY COUNTRY
BY MODEL
ON COUNTRY PAGE-BREAK

HEADING
"<TITLE"

ON TABLE PCHOLD FORMAT PDF
END

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


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 15, 2014, 02:15 PM
djackson
Thank you very much Martin. I was trying to simplify my code by using the car file, but realized I didn't really express what my issue was. All of my output will be in the heading. If the country is France, the heading will produce only two lines, for all other countries the heading should be three.

I've corrected the code -

TABLE FILE CAR
SUM
SEATS NOPRINT
BY COUNTRY NOPRINT
BY MODEL NOPRINT
ON COUNTRY PAGE-BREAK

-IF COUNTRY IS 'FRANCE' THEN GOTO HEADING2 ELSE IF COUNTRY NE 'FRANCE' THEN GOTO NOTFRANCE;
-NOTFRANCE
HEADING
"THIS COUNTRY IS NOT FRANCE <60>" "
"Model Name <60>" "
"Number of Seats (eliminate this line if France) <58>
-GOTO FINISHUP

-HEADING2
HEADING
"THIS COUNTRY SHOULD BE FRANCE<60>" "
"Model Name <60>
-FINISHUP

ON TABLE PCHOLD FORMAT PDF
END

Again, I'm sorry I did not get my code correct to show what I was trying to get done.

thanks, Donna


Dev Studio 8.1.0.4, App Studio 8.1.5m, Reporting Server 8.1.4, InfoAssist, Active Technologies, Windows 2003 Server, Windows7
September 15, 2014, 02:53 PM
MartinY
Hi Donna, not quit sure what is your goal, but except if other Guru tells the opposite, you cannot really have all of your output in the header except if you pre-calculate them especially in this example where there are multiple Model that cannot be aggregated in a single header.

My example shows you the detail of the data and as you can see, only the first value is displayed in the header.

DEFINE FILE CAR
TITLE1 /A30V = IF COUNTRY EQ 'FRANCE' THEN 'THIS COUNTRY SHOULD BE FRANCE' ELSE 'THIS COUNTRY IS NOT FRANCE';
TITLE2 /A30V = IF COUNTRY EQ 'FRANCE' THEN 'THIS COUNTRY IS FRANCE' ELSE 'THIS COUNTRY IS NOT FRANCE ***';
END
TABLE FILE CAR
SUM SEATS
BY COUNTRY
BY MODEL
ON COUNTRY PAGE-BREAK

HEADING
"<TITLE1"
"Model Name: <MODEL"
"Number of Seats: <SEATS"
"<TITLE2"
""

ON TABLE PCHOLD FORMAT PDF
END


And I don't know any way to have different number of rows in the header except using variables assigned outside of the TABLE FILE...END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
September 16, 2014, 08:10 AM
Tony A
If you have to use HEADING then what Martin suggests is potentially the method to use.

However, evaluate whether SUBHEAD may work for you because you can utilise the WHEN keyword -
TABLE FILE CAR
SUM
 SEATS NOPRINT
BY COUNTRY NOPRINT
BY MODEL NOPRINT
ON COUNTRY PAGE-BREAK
ON COUNTRY SUBHEAD
"THIS COUNTRY IS NOT FRANCE <60>"
"Model Name <60>"
"Number of Seats (eliminate this line if France) <58>"
WHEN COUNTRY NE 'FRANCE'

ON COUNTRY SUBHEAD
"THIS COUNTRY SHOULD BE FRANCE<60>"
"Model Name <60>"
WHEN COUNTRY EQ 'FRANCE'

ON TABLE PCHOLD FORMAT PDF
END


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 16, 2014, 02:10 PM
djackson
thank you both Martin and Tony - even though I wasn't clear on what I wanted for output... I understand the application of both suggestions and will keep code for future reference. I think the subhead is going to get me where I need to be with output so will go forward with that suggestion.
thanks again! Donna


Dev Studio 8.1.0.4, App Studio 8.1.5m, Reporting Server 8.1.4, InfoAssist, Active Technologies, Windows 2003 Server, Windows7