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     [CLOSED] Save Graph as PDF

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Save Graph as PDF
 Login/Join
 
Member
posted
Hi All,

I am able to save a simple graph code below as PDF.

APP HOLD BASEAPP
GRAPH FILE CAR
SUM RETAIL_COST
BY COUNTRY
ON GRAPH HOLD AS 52122539 FORMAT SVG
END
-RUN
TABLE FILE CAR
SUM COUNTRY
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=REPORT,IMAGE=52122539.SVG,$
ENDSTYLE
END


I am trying to convert the below code for graph to add the code to save it as pdf. But fail to do so. Please help.

JOIN
DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_ELEMENT_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_ELEMENT.DQ_ALL_ELEMENT.DQ_ELEMENT_ID
IN DQ_ALL_ELEMENT TAG J001
AS J001
END
JOIN
J001.DQ_ALL_ELEMENT.DQ_TABLE_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_TABLE.DQ_ALL_TABLE.DQ_TABLE_ID
IN DQ_ALL_TABLE TAG J002
AS J002
END
JOIN
DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_METRIC_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_METRICS.DQ_ALL_METRICS.DQ_METRIC_ID
IN DQ_ALL_METRICS TAG J003
AS J003
END

DEFINE FILE DQ_COLUMN_METRICS_TH
-* DEFINE BEGIN METRIC_VALUE
METRIC_VALUE/I11 = EDIT(DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_METRIC_VAL_TX );
MTHYEAR/MTRYY = PERIOD_DT;
TABLE_ELEMENT/A255='TABLE NAME' || ' : ' | J002.DQ_ALL_TABLE.DQ_TABLE_NM || ' - ' | 'ELEMENT NAME' || ' : ' | J001.DQ_ALL_ELEMENT.DQ_ELEMENT_NM ;
END


TABLE FILE DQ_COLUMN_METRICS_TH
-* Created by Advanced Graph Assistant
SUM METRIC_VALUE AS 'EMPTY COUNT'
BY TABLE_ELEMENT
RANKED BY HIGHEST 4 MTHYEAR
WHERE (J003.DQ_ALL_METRICS.DQ_METRIC_TP EQ 'EMPTY COUNT') AND
J001.DQ_ALL_ELEMENT.IS_ACTIVE_IN EQ 'Y';;
ON TABLE HOLD
END
-RUN


GRAPH FILE HOLD
-* Created by Advanced Graph Assistant
SUM METRIC_VALUE AS 'EMPTY COUNT'
BY TABLE_ELEMENT
BY MTHYEAR AS 'PERIOD DATE'

HEADING
"""

ON GRAPH PCHOLD AS HOLD FORMAT PNG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(),true);
setSeriesType(0,2);
setLegendDisplay(true);
setLegendMarkerPosition(3);
setMarkerDisplay(true);
setUseSeriesShapes(false);
setConnectLineMarkers(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setY1LabelDisplay(true);
setY1AxisSide(0);
setTextFormatPreset(getY1Label(),1);
setY1MajorGridDisplay(true);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlaceResize(getO1Label(),0);
setTextRotation(getO1Label(),3);
setPlaceRotate(getO1Label(),0);
setTextJustHoriz(getO1Label(),0);
setPlaceAlign(getO1Label(),0);
setTextWrap(getO1Label(),true);
setPlaceWordWrap(getO1Label(),0);
setFontSize(getO1Title(),12);
setFontSizeAbsolute(getO1Title(),true);
setPlaceResize(getO1Title(),0);
setTextRotation(getO1Title(),0);
setPlaceRotate(getO1Title(),0);
setTextJustHoriz(getO1Title(),1);
setPlaceAlign(getO1Title(),0);
setTextWrap(getO1Title(),false);
setPlaceWordWrap(getO1Title(),0);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE=DATA, ACROSSCOLUMN=METRIC_VALUE , SIZE=5,COLOR='BLACK', $
TYPE= HEADING,STYLE=BOLD,SIZE=10,COLOR='BLACK',FONT='Times New Roman',$
ENDSTYLE
END
-* End Graph Assistant

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


WebFOCUS 7.6
All Outputs
 
Posts: 8 | Registered: July 30, 2009Report This Post
<JG>
posted
quote:
FORMAT PNG

Is not a valid graph format for PDF output.

Valid formats for images to be include in PDF are gif, jpeg and SVG
 
Report This Post
Member
posted Hide Post
quote:
ON GRAPH PCHOLD AS HOLD FORMAT PNG

Even a after I change PNG to PDF it does not work.


WebFOCUS 7.6
All Outputs
 
Posts: 8 | Registered: July 30, 2009Report This Post
<JG>
posted
Devi please read what I said.

Valid formats for images in a PDF are gif, jpeg and SVG.

PDF is not a valid graph format.

As in your example at the top of your post, you generate the graph in the required HOLD format
and then include it in the stylesheet of a PDF report.
 
Report This Post
Member
posted Hide Post
quote:
example at the top of your

Ohh sorry... I made the following change to the code and saved the graph as dq1.svg

JOIN
DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_ELEMENT_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_ELEMENT.DQ_ALL_ELEMENT.DQ_ELEMENT_ID
IN DQ_ALL_ELEMENT TAG J001
AS J001
END
JOIN
J001.DQ_ALL_ELEMENT.DQ_TABLE_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_TABLE.DQ_ALL_TABLE.DQ_TABLE_ID
IN DQ_ALL_TABLE TAG J002
AS J002
END
JOIN
DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_METRIC_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_METRICS.DQ_ALL_METRICS.DQ_METRIC_ID
IN DQ_ALL_METRICS TAG J003
AS J003
END

DEFINE FILE DQ_COLUMN_METRICS_TH
-* DEFINE BEGIN METRIC_VALUE
METRIC_VALUE/I11 = EDIT(DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_METRIC_VAL_TX );
MTHYEAR/MTRYY = PERIOD_DT;
TABLE_ELEMENT/A255='TABLE NAME' || ' : ' | J002.DQ_ALL_TABLE.DQ_TABLE_NM || ' - ' | 'ELEMENT NAME' || ' : ' | J001.DQ_ALL_ELEMENT.DQ_ELEMENT_NM ;
END

APP HOLD BASEAPP

TABLE FILE DQ_COLUMN_METRICS_TH
-* Created by Advanced Graph Assistant
SUM METRIC_VALUE AS 'EMPTY COUNT'
BY TABLE_ELEMENT
RANKED BY HIGHEST 4 MTHYEAR
WHERE (J003.DQ_ALL_METRICS.DQ_METRIC_TP EQ 'EMPTY COUNT') AND
J001.DQ_ALL_ELEMENT.IS_ACTIVE_IN EQ 'Y';;
ON TABLE HOLD AS DQ1
END
-RUN


GRAPH FILE DQ1
-* Created by Advanced Graph Assistant
SUM METRIC_VALUE AS 'EMPTY COUNT'
BY TABLE_ELEMENT
BY MTHYEAR AS 'PERIOD DATE'

HEADING
"""

ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(),true);
setSeriesType(0,2);
setLegendDisplay(true);
setLegendMarkerPosition(3);
setMarkerDisplay(true);
setUseSeriesShapes(false);
setConnectLineMarkers(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setY1LabelDisplay(true);
setY1AxisSide(0);
setTextFormatPreset(getY1Label(),1);
setY1MajorGridDisplay(true);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlaceResize(getO1Label(),0);
setTextRotation(getO1Label(),3);
setPlaceRotate(getO1Label(),0);
setTextJustHoriz(getO1Label(),0);
setPlaceAlign(getO1Label(),0);
setTextWrap(getO1Label(),true);
setPlaceWordWrap(getO1Label(),0);
setFontSize(getO1Title(),12);
setFontSizeAbsolute(getO1Title(),true);
setPlaceResize(getO1Title(),0);
setTextRotation(getO1Title(),0);
setPlaceRotate(getO1Title(),0);
setTextJustHoriz(getO1Title(),1);
setPlaceAlign(getO1Title(),0);
setTextWrap(getO1Title(),false);
setPlaceWordWrap(getO1Title(),0);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE=DATA, ACROSSCOLUMN=METRIC_VALUE , SIZE=5,COLOR='BLACK', $
TYPE= HEADING,STYLE=BOLD,SIZE=10,COLOR='BLACK',FONT='Times New Roman',$
ENDSTYLE
ON GRAPH HOLD AS DQ1 FORMAT SVG
END
-RUN

TABLE FILE DQ1
SUM METRIC_VALUE NOPRINT
ON TABLE SET STYLE *
TYPE=REPORT,
IMAGE=DQ1.SVG,
GRID=OFF,
$
ENDSTYLE
ON TABLE PCHOLD FORMAT PDF
END
-* End Graph Assistant


But receive the error message as below:

0 NUMBER OF RECORDS IN TABLE= 135 LINES= 135
(BEFORE TOTAL TESTS)
0 NUMBER OF RECORDS IN GRAPH= 91 PLOT POINTS= 91
SVG FILE SAVED ...
0 ERROR AT OR NEAR LINE 122 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC3251) IMAGE FILE UNREADABLE OR INVALID: dq1.svg


WebFOCUS 7.6
All Outputs
 
Posts: 8 | Registered: July 30, 2009Report This Post
<JG>
posted
quote:
BY TABLE_ELEMENT
BY MTHYEAR AS 'PERIOD DATE'

Problem is that you are not creating what you think.

BY FIELD1
BY FIELD2

Will generate multiple graphs. Not the single dq1.svg that you are expecting.

In the Advanced Graph Assistant set the graph merge on or add ON GRAPH SET GRMERGE ON to your code
 
Report This Post
Member
posted Hide Post
Thanks for that input. Yes we will get multiple graphs in our case and we want to save it as one pdf file.

I am new to WebFocus hence not aware much of the code. ON GRAPH SET GRMERGE ON is added to my code but this time it does not give an error but show a CROSS symbol as output without displaying anything.

Please help.


WebFOCUS 7.6
All Outputs
 
Posts: 8 | Registered: July 30, 2009Report This Post
<JG>
posted
If you use the report composer then it will place your graph or graphs (if you do not set GRMERGE) for you

Alternatively use the following

TYPE=REPORT,IMAGE=DQ10.SVG,POSITION=(3.0 0.5), SIZE=(3.5 2.5), $
TYPE=REPORT,IMAGE=DQ11.SVG,POSITION=(3.0 3.0), SIZE=(3.5 2.5), $
TYPE=REPORT,IMAGE=DQ12.SVG,POSITION=(3.0 5.5), SIZE=(3.5 2.5), $
TYPE=REPORT,IMAGE=DQ13.SVG,POSITION=(3.0 8.0), SIZE=(3.5 2.5), $

check how many image files are being created by adding

!DIR
-EXIT

after your graph (!ls on unix)
 
Report This Post
Member
posted Hide Post
Hi JG,

I am now able to save the graph as one SVG file and then display it in PDF. Thanks

But the content of the graph displayed is not as per desired. It shows only one graphs with all the others merged into it.

How do i save these separate graphs? I will not know how many graphs I will get as the data is dynamic.

Please help


WebFOCUS 7.6
All Outputs
 
Posts: 8 | Registered: July 30, 2009Report This Post
Member
posted Hide Post
The code now looks like

JOIN
DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_ELEMENT_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_ELEMENT.DQ_ALL_ELEMENT.DQ_ELEMENT_ID
IN DQ_ALL_ELEMENT TAG J001
AS J001
END
JOIN
J001.DQ_ALL_ELEMENT.DQ_TABLE_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_TABLE.DQ_ALL_TABLE.DQ_TABLE_ID
IN DQ_ALL_TABLE TAG J002
AS J002
END
JOIN
DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_METRIC_ID
IN DQ_COLUMN_METRICS_TH
TO MULTIPLE DQ_ALL_METRICS.DQ_ALL_METRICS.DQ_METRIC_ID
IN DQ_ALL_METRICS TAG J003
AS J003
END

DEFINE FILE DQ_COLUMN_METRICS_TH
-* DEFINE BEGIN METRIC_VALUE
METRIC_VALUE/I11 = EDIT(DQ_COLUMN_METRICS_TH.DQ_COLUMN_METRICS_TH.DQ_METRIC_VAL_TX );
MTHYEAR/MTRYY = PERIOD_DT;
TABLE_ELEMENT/A255='TABLE NAME' || ' : ' | J002.DQ_ALL_TABLE.DQ_TABLE_NM || ' - ' | 'ELEMENT NAME' || ' : ' | J001.DQ_ALL_ELEMENT.DQ_ELEMENT_NM ;
END



TABLE FILE DQ_COLUMN_METRICS_TH
-* Created by Advanced Graph Assistant
SUM METRIC_VALUE AS 'EMPTY COUNT'
BY TABLE_ELEMENT
RANKED BY HIGHEST 4 MTHYEAR
WHERE (J003.DQ_ALL_METRICS.DQ_METRIC_TP EQ 'EMPTY COUNT') AND
J001.DQ_ALL_ELEMENT.IS_ACTIVE_IN EQ 'Y';;
ON TABLE HOLD AS DQ1
END
-RUN

APP HOLD BASEAPP

GRAPH FILE DQ1
-* Created by Advanced Graph Assistant
SUM METRIC_VALUE AS 'EMPTY COUNT'
BY TABLE_ELEMENT
BY MTHYEAR AS 'PERIOD DATE'

HEADING
"""

ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET VZERO ON
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(),true);
setSeriesType(0,2);
setLegendDisplay(true);
setLegendMarkerPosition(3);
setMarkerDisplay(true);
setUseSeriesShapes(false);
setConnectLineMarkers(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setY1LabelDisplay(true);
setY1AxisSide(0);
setTextFormatPreset(getY1Label(),1);
setY1MajorGridDisplay(true);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlaceResize(getO1Label(),0);
setTextRotation(getO1Label(),3);
setPlaceRotate(getO1Label(),0);
setTextJustHoriz(getO1Label(),0);
setPlaceAlign(getO1Label(),0);
setTextWrap(getO1Label(),true);
setPlaceWordWrap(getO1Label(),0);
setFontSize(getO1Title(),12);
setFontSizeAbsolute(getO1Title(),true);
setPlaceResize(getO1Title(),0);
setTextRotation(getO1Title(),0);
setPlaceRotate(getO1Title(),0);
setTextJustHoriz(getO1Title(),1);
setPlaceAlign(getO1Title(),0);
setTextWrap(getO1Title(),false);
setPlaceWordWrap(getO1Title(),0);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE=DATA, ACROSSCOLUMN=METRIC_VALUE , SIZE=5,COLOR='BLACK', $
TYPE= HEADING,STYLE=BOLD,SIZE=10,COLOR='BLACK',FONT='Times New Roman',$
ENDSTYLE
ON GRAPH HOLD AS NULLSVG FORMAT SVG
END
-RUN

TABLE FILE DQ1
SUM METRIC_VALUE NOPRINT
ON TABLE SET STYLE *
TYPE=REPORT,IMAGE=NULLSVG.SVG, GRID=OFF, $
ENDSTYLE
ON TABLE PCHOLD FORMAT PDF
END
-* End Graph Assistant


WebFOCUS 7.6
All Outputs
 
Posts: 8 | Registered: July 30, 2009Report This Post
<JG>
posted
To get your individual graphs you must remove the GRMERGE statement.

As I said if you use the composer to create the report then it should automatically
insert the graphs

However if you want to do it manually then you need to manipulate it.

This expands on a technique posted previously (a folder in the APP PATH is an absolute requirement)

APP HOLD BASEAPP
-RUN
GRAPH FILE CAR
SUM RETAIL_COST
BY CAR
BY MODEL
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
ENDSTYLE
ON GRAPH SET STYLE *
TYPE=DATA, ACROSSCOLUMN=METRIC_VALUE , SIZE=5,COLOR='BLACK', $
TYPE= HEADING,STYLE=BOLD,SIZE=10,COLOR='BLACK',FONT='Times New Roman',$
ENDSTYLE
ON GRAPH HOLD AS DQ1 FORMAT SVG
END
-RUN
TABLE FILE CAR
SUM
COMPUTE CNTR/D5.0 = LAST CNTR +1 ; NOPRINT
COMPUTE IMAGE/A5 = FTOA(CNTR -1, '(D5.0)', 'A5'); NOPRINT
COMPUTE GRAPH/A12= 'DQ1' || LJUST(5,IMAGE,'A5') || '.svg'; AS ''
BY CAR NOPRINT
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=GRAPH, IMAGE=(GRAPH),SIZE=(6.0 1.5),$
ENDSTYLE
END
 
Report This Post
Member
posted Hide Post
Hi,
Saving Graph as PDF is easy by using PDF Creator PDF Creator


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 1 | Registered: August 30, 2012Report 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     [CLOSED] Save Graph as PDF

Copyright © 1996-2020 Information Builders