Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Multiple graphs into PDF

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Multiple graphs into PDF
 Login/Join
 
Member
posted
There's probably an easy answer to this but I've searched the forum
and can't find it. Basically I have a job that outputs multiple graphs
which the end users now want a pdf in. The code below is based on CAR
and I cannot refer to it in the PDF layout painter ( or whatever it's
called in the version you use ).
Any help would be appreciated.
Thanks
Paul

 
-*test_job

GRAPH FILE CAR
-* Created by Advanced Graph Assistant
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
ACROSS CAR.CARREC.MODEL
ON GRAPH PCHOLD AS HOLD FORMAT GIF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRWIDTH 2
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET GRAPHSTYLE *
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTextString(getTitle(),"");
ENDSTYLE
END


This is then called in this fex :

  
SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF
UNITS=IN, $
SECTION=section1, LAYOUT=ON, METADATA='0.5^0.5^0.5^0.5', MERGE=OFF, ORIENTATION=PORTRAIT, PAGESIZE=A3, $
PAGELAYOUT=1, NAME='Page layout 1', text='Page layout 1', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=0.5, 
METADATA='BOTTOMMARGIN=0.5,TOPMARGIN=0.5,LEFTMARGIN=0,RIGHTMARGIN=0,', $
COMPONENT='report1', TEXT='report1', TOC-LEVEL=2, POSITION=(0.520 0.311), DIMENSION=(10.626 11.775), 
METADATA='Z-INDEX: 100; LEFT: 0.52in; OVERFLOW: auto; WIDTH: 10.626in; POSITION: absolute; TOP: 0.311in;
HEIGHT: 11.775in', $
END
SET COMPONENT='report1'
-*component_type report
-INCLUDE test_job
COMPOUND END

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


Developer Studio Release : 7.6.11
 
Posts: 21 | Location: TataSteel Strip Products UK , Port Talbot , South Wales | Registered: November 28, 2006Report This Post
Expert
posted Hide Post
EDIT: Removed the -INCLUDE and hard-coded the server IP address; need to change for your IP...

&SERVER is the IP address of the Reporting Server:

  
-* File excel_graph_rpt.fex
APP PREPENDPATH IBISAMP
-RUN
-SET &ECHO=ALL;
-SET &ENV        = 'PROD4';
-**************************************
-* CHANGE TO YOUR SERVER IP ADDRESS   *
-**************************************
-SET &SERVER     = '150.108.28.XXX:8080';
-SET &PDF_URL    = &SERVER || &FOCEXURL;
-SET &FMT        = 'PDF';
-SET &APPFOLDER  = 'baseapp/';
-SET &USERID     = GETUSER('A8');
-SET &LC_USER    = LOCASE(8, &USERID, 'A8');
-SET &GIF_FILE1  = &LC_USER || 'graph1' || '.jpg' ;
-SET &PATH       = &APPFOLDER || &GIF_FILE1;
APP FI GRAPH2 DISK &PATH
-RUN
GRAPH FILE CAR
SUM
     RETAIL_COST AS ''
ACROSS COUNTRY
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET HAXIS 520
ON GRAPH SET VAXIS 205
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIE
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH HOLD AS GRAPH2 FORMAT JPEG
ON GRAPH SET STYLE *
TYPE = REPORT,  FONT=VERDANA, SIZE=9, $
TYPE = HEADING, FONT=VERDANA, SIZE=10, STYLE=BOLD, $
ENDSTYLE
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setFontName(getDataText(),"Verdana");
setDepthAngle(65);
setPieDepth(45);
restoreAllSlices();
setPieFeelerTextDisplay(2);
setPieTilt(25);
setPieLabelDisplay(0);
setDisplay(getPieLabel(),true);
setLegendAutomatic(false);
setFontStyle(getLegendText(),2);
setFontStyle(getPieSliceLabel(),2);
setTextFormatPreset(getPieSliceLabel(),5);
setFontSizeInPoints(getTitle(),12);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),9);
setTextFormatPattern(getDataText(),"$#,###,###,###.##");
setFontSizeInPoints(getO1Label(),9);
setFontSizeInPoints(getY1Label(),9);
setFontSize(getDataText(),10);
setFontSizeAbsolute(getTitle(),true);
setFontSizeInPoints(getTitle(),12);
setLegendMarkerPosition(0);
setTransparentBorderColor(getChartBackground(),true);
setRect(getPieFrame(), new Rectangle(-15500,-13500,27000,27000));
setRect(getFrame(), new Rectangle(-10400,-10000,25000,30000));
setTextString(getTitle(),"TOTAL RETAIL COST BY COUNTRY");
ENDSTYLE
END
-RUN
-SET &GIF_FILE2  = &LC_USER || 'graph2' || '.jpg' ;
-SET &PATH       = &APPFOLDER || &GIF_FILE2;
APP FI GRAPH2 DISK &PATH
-RUN
GRAPH FILE CAR
SUM
   COMPUTE PROFIT/P13.2M = RETAIL_COST-DEALER_COST; AS ' '
ACROSS COUNTRY
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET HAXIS 520
ON GRAPH SET VAXIS 205
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIE
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH HOLD AS GRAPH2 FORMAT JPEG
ON GRAPH SET STYLE *
TYPE = REPORT,  FONT=VERDANA, SIZE=9, $
TYPE = HEADING, FONT=VERDANA, SIZE=10, STYLE=BOLD, $
ENDSTYLE
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setFontName(getDataText(),"Verdana");
setDepthAngle(65);
setPieDepth(45);
restoreAllSlices();
setPieFeelerTextDisplay(2);
setPieTilt(25);
setPieLabelDisplay(0);
setDisplay(getPieLabel(),true);
setLegendAutomatic(false);
setFontStyle(getLegendText(),2);
setFontStyle(getPieSliceLabel(),2);
setTextFormatPreset(getPieSliceLabel(),5);
setFontSizeInPoints(getTitle(),12);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),9);
setTextFormatPattern(getDataText(),"$#,###,###,###.##");
setFontSizeInPoints(getO1Label(),9);
setFontSizeInPoints(getY1Label(),9);
setFontSize(getDataText(),10);
setFontSizeAbsolute(getTitle(),true);
setFontSizeInPoints(getTitle(),12);
setLegendMarkerPosition(0);
setTransparentBorderColor(getChartBackground(),true);
setRect(getPieFrame(), new Rectangle(-15500,-13500,27000,27000));
setRect(getFrame(), new Rectangle(-10400,-10000,25000,30000));
setTextString(getTitle(),"TOTAL PROFIT BY COUNTRY");
ENDSTYLE
END
-RUN
SET GRAPHSERVURL = 'http://' || '&SERVER.EVAL' || '/ibi_apps/IBIGraphServlet'
SET FOCEXURL     = 'http://' || '&SERVER.EVAL' || '/ibi_apps/WFServlet'
-RUN
DEFINE FILE CAR
 IMAGE1/A200='<img src=http://' || '&SERVER.EVAL' || '/approot/baseapp/&GIF_FILE1>';
 IMAGE2/A200='<img src=http://' || '&SERVER.EVAL' || '/approot/baseapp/&GIF_FILE2>';
 X1A/A15         = '<TABLE>';
 X1B/A15         = '<TR>';
 X1C/A20         = '</TR>';
 X1D/A10         = '</TABLE>';
 X1E/A30         = '<TD COLSPAN=5 align="left">';
 X_END/A5        = '</TD>';
 X2A/A30         = '<TD COLSPAN=5 align="right">';
END
TABLE FILE CAR
HEADING
-IF &FMT EQ 'PDF' GOTO SKIP_LINE1A;
"<X1A<X1B<X1E<IMAGE1<X_END<X2A<IMAGE2<X_END<X1C<X1D"
-SKIP_LINE1A
"</14 "
SUM
  DEALER_COST/P13.2M AS 'Dealer Cost'
  RETAIL_COST/P13.2M AS 'Retail Cost'
    COMPUTE PROFIT/P13.2M = RETAIL_COST-DEALER_COST; AS 'Profit'
  SALES/P13.2M AS 'Sales'
BY COUNTRY AS 'Country'
BY CAR AS 'Car'
BY MODEL AS 'Model'
BY BODYTYPE AS 'Body Style'
ON COUNTRY SUBFOOT
" "
ON TABLE SET PAGE-NUM OFF
ON TABLE SET HTMLCSS ON
ON TABLE PCHOLD FORMAT &FMT OPEN
ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='Letter',
     LEFTMARGIN=0.400000,
     RIGHTMARGIN=0.050000,
     TOPMARGIN=0.000000,
     BOTTOMMARGIN=0.000000,
     ORIENTATION=LANDSCAPE,
     SQUEEZE=ON,
$
TYPE=TITLE, STYLE=BOLD, SIZE=10, FONT=VERDANA,$
TYPE=REPORT, TITLETEXT='Report 1',$
-IF &FMT NE 'PDF' GOTO SKIP_IMAGE1;
TYPE=HEADING, IMAGE='&GIF_FILE1.EVAL', POSITION=(+5.0 +0.00), SIZE=(5.00 2.25), $
TYPE=HEADING, IMAGE='&GIF_FILE2.EVAL', POSITION=(+0.0 +0.00), SIZE=(5.00 2.25), $
-SKIP_IMAGE1
ENDSTYLE
END
-RUN

-SET &ECHO=ALL;
-SET &APPFOLDER  = 'baseapp/';
-SET &USERID     = GETUSER('A8');
-SET &LC_USER    = LOCASE(8, &USERID, 'A8');
-SET &GIF_FILE1  = &LC_USER || 'graph1' || '.jpg' ;
-SET &PATH       = &APPFOLDER || &GIF_FILE1;
APP FI GRAPH2 DISK &PATH
-RUN
GRAPH FILE CAR
SUM
     RETAIL_COST AS ''
ACROSS COUNTRY
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET HAXIS 520
ON GRAPH SET VAXIS 205
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIE
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH HOLD AS GRAPH2 FORMAT JPEG
ON GRAPH SET STYLE *
TYPE = REPORT,  FONT=VERDANA, SIZE=9, $
TYPE = HEADING, FONT=VERDANA, SIZE=10, STYLE=BOLD, $
ENDSTYLE
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setFontName(getDataText(),"Verdana");
setDepthAngle(65);
setPieDepth(45);
restoreAllSlices();
setPieFeelerTextDisplay(2);
setPieTilt(25);
setPieLabelDisplay(0);
setDisplay(getPieLabel(),true);
setLegendAutomatic(false);
setFontStyle(getLegendText(),2);
setFontStyle(getPieSliceLabel(),2);
setTextFormatPreset(getPieSliceLabel(),5);
setFontSizeInPoints(getTitle(),12);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),9);
setTextFormatPattern(getDataText(),"$#,###,###,###.##");
setFontSizeInPoints(getO1Label(),9);
setFontSizeInPoints(getY1Label(),9);
setFontSize(getDataText(),10);
setFontSizeAbsolute(getTitle(),true);
setFontSizeInPoints(getTitle(),12);
setLegendMarkerPosition(0);
setTransparentBorderColor(getChartBackground(),true);
setRect(getPieFrame(), new Rectangle(-15500,-13500,27000,27000));
setRect(getFrame(), new Rectangle(-10400,-10000,25000,30000));
setTextString(getTitle(),"TOTAL RETAIL COST BY COUNTRY");
ENDSTYLE
END
-RUN
-SET &GIF_FILE2  = &LC_USER || 'graph2' || '.jpg' ;
-SET &PATH       = &APPFOLDER || &GIF_FILE2;
APP FI GRAPH2 DISK &PATH
-RUN
GRAPH FILE CAR
SUM
   COMPUTE PROFIT/P13.2M = RETAIL_COST-DEALER_COST; AS ' '
ACROSS COUNTRY
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET HAXIS 520
ON GRAPH SET VAXIS 205
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIE
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH HOLD AS GRAPH2 FORMAT JPEG
ON GRAPH SET STYLE *
TYPE = REPORT,  FONT=VERDANA, SIZE=9, $
TYPE = HEADING, FONT=VERDANA, SIZE=10, STYLE=BOLD, $
ENDSTYLE
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setFontName(getDataText(),"Verdana");
setDepthAngle(65);
setPieDepth(45);
restoreAllSlices();
setPieFeelerTextDisplay(2);
setPieTilt(25);
setPieLabelDisplay(0);
setDisplay(getPieLabel(),true);
setLegendAutomatic(false);
setFontStyle(getLegendText(),2);
setFontStyle(getPieSliceLabel(),2);
setTextFormatPreset(getPieSliceLabel(),5);
setFontSizeInPoints(getTitle(),12);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),9);
setTextFormatPattern(getDataText(),"$#,###,###,###.##");
setFontSizeInPoints(getO1Label(),9);
setFontSizeInPoints(getY1Label(),9);
setFontSize(getDataText(),10);
setFontSizeAbsolute(getTitle(),true);
setFontSizeInPoints(getTitle(),12);
setLegendMarkerPosition(0);
setTransparentBorderColor(getChartBackground(),true);
setRect(getPieFrame(), new Rectangle(-15500,-13500,27000,27000));
setRect(getFrame(), new Rectangle(-10400,-10000,25000,30000));
setTextString(getTitle(),"TOTAL PROFIT BY COUNTRY");
ENDSTYLE
END
-RUN
DEFINE FILE CAR
 IMAGE2/A200='<img src=http://' || '&SERVER.EVAL' || '/approot/baseapp/&GIF_FILE1>';
 IMAGE1/A200='<img src=http://' || '&SERVER.EVAL' || '/approot/baseapp/&GIF_FILE2>';
 X1A/A15         = '<TABLE>';
 X1B/A15         = '<TR>';
 X1C/A20         = '</TR>';
 X1D/A10         = '</TABLE>';
 X1E/A30         = '<TD COLSPAN=5 align="left">';
 X_END/A5        = '</TD>';
 X2A/A30         = '<TD COLSPAN=5 align="right">';
END
TABLE FILE CAR
HEADING
-IF &FMT EQ 'PDF' GOTO SKIP_LINE1AB;
"<X1A<X1B<X1E<IMAGE1<X_END<X2A<IMAGE2<X_END<X1C<X1D"
-SKIP_LINE1AB
"</14 "
SUM
  DEALER_COST/P13.2M AS 'Dealer Cost'
  RETAIL_COST/P13.2M AS 'Retail Cost'
    COMPUTE PROFIT/P13.2M = RETAIL_COST-DEALER_COST; AS 'Profit'
  SALES/P13.2M AS 'Sales'
BY COUNTRY AS 'Country'
BY CAR AS 'Car'
BY MODEL AS 'Model'
BY BODYTYPE AS 'Body Style'
ON COUNTRY SUBFOOT
" "
ON TABLE SET PAGE-NUM OFF
ON TABLE SET HTMLCSS ON
ON TABLE PCHOLD FORMAT &FMT CLOSE
ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='Letter',
     LEFTMARGIN=0.400000,
     RIGHTMARGIN=0.050000,
     TOPMARGIN=0.000000,
     BOTTOMMARGIN=0.000000,
     ORIENTATION=LANDSCAPE,
     SQUEEZE=ON,
$
TYPE=TITLE,  STYLE=BOLD, SIZE=10, FONT=VERDANA, $
TYPE=REPORT, TITLETEXT='Report 2',$
-IF &FMT NE 'PDF' GOTO SKIP_IMAGE2;
TYPE=HEADING, IMAGE='&GIF_FILE2.EVAL', POSITION=(+5.0 +0.00), SIZE=(5.00 2.25), $
TYPE=HEADING, IMAGE='&GIF_FILE1.EVAL', POSITION=(+0.0 +0.00), SIZE=(5.00 2.25), $
-SKIP_IMAGE2

ENDSTYLE
END
-RUN


hth

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Member
posted Hide Post
Thanks Tom , I guess then it's some sort of bug
whereby we have to create each graph individually
rather than quite simply with the multi graph option.

This will be quite a tedious task to code as it's over
100 graphs when fully populated.

Nothing's ever easy is it lol

Thanks again,
Paul


Developer Studio Release : 7.6.11
 
Posts: 21 | Location: TataSteel Strip Products UK , Port Talbot , South Wales | Registered: November 28, 2006Report This Post
Member
posted Hide Post
Would like to know who put this as solved though as
it wasn't me Confused

I did kind of hope there was a more elegent solution
out there and had left it open to see if anyone else
had some moments of genius. As it is we have had to
create about a hundred individual graphs as the loop
will not perform what we require although may be
suitable for other pieces of work.


Developer Studio Release : 7.6.11
 
Posts: 21 | Location: TataSteel Strip Products UK , Port Talbot , South Wales | Registered: November 28, 2006Report This Post
Expert
posted Hide Post
Kerry of IBI entered the "SOLVED", as you can see from your 1st Post Edited By.

Just edit your 1st Post and change it.

Also, add that you do not want it closed or solved, that you are waiting for a more "elegant" solution...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Member
posted Hide Post
Duh I guess I was being a bit dull Tom , I totally missed the edited
by bit as I saw there was a new post and scrolled straight to the bottom
whereas the new post was the re-edit. I think I'll leave it as SOLVED as
I don't believe there is a better solution than yours.

Thanks again,
Paul


Developer Studio Release : 7.6.11
 
Posts: 21 | Location: TataSteel Strip Products UK , Port Talbot , South Wales | Registered: November 28, 2006Report This Post
Gold member
posted Hide Post
Madasabear,

If I were to be doing something like this I would use loops. Below is an example for just the graph

  
TABLE FILE CAR
SUM COUNTRY
BY COUNTRY
ON TABLE SAVE AS COUNTRIES
END
-RUN
-SET &VALUES = &LINES ;
-RUN 
-TYPE &VALUES

-SET &IDX=1;
-REPEAT :LOOP &VALUES TIMES
-READ COUNTRIES NOCLOSE, &CNTRY.10.
-RUN
-*SET &CNTRY = TRIM('&CNTRY.EVAL');
GRAPH FILE CAR
-* Created by Advanced Graph Assistant
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
ACROSS CAR.CARREC.MODEL
WHERE COUNTRY EQ '&CNTRY.EVAL'
ON GRAPH PCHOLD AS HOLD FORMAT GIF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRWIDTH 2
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET GRAPHSTYLE *
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTextString(getTitle(),"");
ENDSTYLE
END

-:LOOP



You could then expand on this and use a loop (since you know how many graphs you need from &VALUES) to create the positioning of the graphs in the layout part of the code, then use a loop to create the calls of the report and create all the graphs you need.

Hope this sparks some ideas for you.


Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7
 
Posts: 95 | Registered: July 31, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Multiple graphs into PDF

Copyright © 1996-2020 Information Builders