January 31, 2012, 01:11 AM
SriAravindWHERE TOTAL (name of % field) GT 0 is also not working.
Actually the value is not zero. But the % is showing as zero.
I'll give u similar sample code of the issue:
TABLE FILE CAR
SUM DEALER_COST AS 'DCOST'
BY CAR
WHERE CAR EQ 'BMW' OR 'JAGUAR'
END
RESULT:
CAR DCOST
----- -------
BMW 50000.000
JAGUAR 100.000
But while using the same for PIE graph, getting 0% for Jaguar and 100% for BMW
GRAPH FILE CAR
SUM DEALER_COST AS 'DCOST'
BY CAR
WHERE CAR EQ 'BMW' OR 'JAGUAR'
HEADING CENTER
"CAR SAMPLE GRAPH"
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 200
ON GRAPH SET VAXIS 200
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIESINGL
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 0
ON GRAPH SET GRAPHSTYLE *
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDepthRadius(5);
setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
setTransparentBorderColor(getSeries(3),true);
setTransparentBorderColor(getSeries(4),true);
setTransparentBorderColor(getSeries(5),true);
setTransparentBorderColor(getSeries(6),true);
setTransparentBorderColor(getSeries(7),true);
setTransparentBorderColor(getSeries(8),true);
setTransparentBorderColor(getSeries(9),true);
setTransparentBorderColor(getSeries(10),true);
setPieDepth(10);
setPlace(true);
setPieLabelDisplay(3);
setDisplay(getLegendArea(),false);
setOtherPieLabelDisplay(3);
setFontName(getTitle(),"SansSerif");
setFillColor(getTitle(),new Color(32,0,32));
setFontStyle(getTitle(),2);
setFontSizeAbsolute(getTitle(),true);
setFontSizeInPoints(getTitle(),10);
setPlaceResize(getTitle(),0);
setTextWrap(getPieLabel(),true);
setGradientDirection(getSeries(0),9);
setFillType(getSeries(0),1);
setFillColor(getSeries(1),new Color(66,102,179));
setFillColor(getSeries(2),new Color(211,203,79));
setFillColor(getSeries(3),new Color(78,143,109));
setFillColor(getSeries(4),new Color(214,130,40));
setFillColor(getSeries(5),new Color(164,120,90));
setFillColor(getSeries(6),new Color(191,68,62));
setFillColor(getSeries(7),new Color(153,102,51));
setFillColor(getSeries(8),new Color(145,165,65));
setFillColor(getSeries(9),new Color(95,160,160));
setFillColor(getSeries(10),new Color(176,96,140));
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setPlaceResize(getPieSliceLabel(),0);
setFontSizeAbsolute(getPieLabel(),true);
setFontSizeInPoints(getPieLabel(),8);
setPlaceResize(getPieLabel(),0);
setFillColor(getSeries(0),new Color(118,101,188));
setFontStyle(getPieSliceLabel(),0);
setFontStyle(getPieLabel(),0);
setTransparentBorderColor(getChartBackground(),false);
setPieFeelerTextDisplay(1);
setRect(getPieFrame(),new Rectangle(-15520.0,-13672.0,36373.0,26084.0));
setTextString(getSubtitle(),"\n\n\n");
setTextString(getTitle()," \n");
setDisplay(getTitle(),true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE=HEADING, LINE=1, ITEM=1, OBJECT=TEXT, SIZE=10, STYLE=BOLD, FONT='ARIAL', JUSTIFY=CENTER, $
ENDSTYLE
END
January 31, 2012, 08:17 AM
njsdenI'm sure there should be a more "direct" way to get what you need but this may work for now.
DEFINE FILE CAR
DEAL/D12.2=IF CAR EQ 'DATSUN' THEN 100 ELSE DEALER_COST;
END
TABLE FILE CAR
SUM
CAR.BODY.DEAL
COMPUTE PCT_DEAL/I3% = PCT.CAR.BODY.DEAL;
BY CAR.COMP.CAR
WHERE CAR EQ 'BMW' OR 'DATSUN' OR 'JAGUAR';
ON TABLE NOTOTAL
END
Will give you these results:
By HOLDing those results and excluding the one with 0% would give you:
DEFINE FILE CAR
DEAL/D12.2=IF CAR EQ 'DATSUN' THEN 100 ELSE DEALER_COST;
END
TABLE FILE CAR
SUM
CAR.BODY.DEAL
COMPUTE PCT_DEAL/I3% = PCT.CAR.BODY.DEAL;
BY CAR.COMP.CAR
WHERE CAR EQ 'BMW' OR 'DATSUN' OR 'JAGUAR';
ON TABLE NOTOTAL
ON TABLE HOLD AS HDATA
ON TABLE SET ASNAMES ON
END
GRAPH FILE HDATA
SUM DEAL
BY CAR
WHERE PCT_DEAL GT 0
HEADING CENTER
"CAR SAMPLE GRAPH"
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 200
ON GRAPH SET VAXIS 200
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIESINGL
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 0
ON GRAPH SET GRAPHSTYLE *
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDepthRadius(5);
setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
setTransparentBorderColor(getSeries(3),true);
setTransparentBorderColor(getSeries(4),true);
setTransparentBorderColor(getSeries(5),true);
setTransparentBorderColor(getSeries(6),true);
setTransparentBorderColor(getSeries(7),true);
setTransparentBorderColor(getSeries(8),true);
setTransparentBorderColor(getSeries(9),true);
setTransparentBorderColor(getSeries(10),true);
setPieDepth(10);
setPlace(true);
setPieLabelDisplay(3);
setDisplay(getLegendArea(),false);
setOtherPieLabelDisplay(3);
setFontName(getTitle(),"SansSerif");
setFillColor(getTitle(),new Color(32,0,32));
setFontStyle(getTitle(),2);
setFontSizeAbsolute(getTitle(),true);
setFontSizeInPoints(getTitle(),10);
setPlaceResize(getTitle(),0);
setTextWrap(getPieLabel(),true);
setGradientDirection(getSeries(0),9);
setFillType(getSeries(0),1);
setFillColor(getSeries(1),new Color(66,102,179));
setFillColor(getSeries(2),new Color(211,203,79));
setFillColor(getSeries(3),new Color(78,143,109));
setFillColor(getSeries(4),new Color(214,130,40));
setFillColor(getSeries(5),new Color(164,120,90));
setFillColor(getSeries(6),new Color(191,68,62));
setFillColor(getSeries(7),new Color(153,102,51));
setFillColor(getSeries(8),new Color(145,165,65));
setFillColor(getSeries(9),new Color(95,160,160));
setFillColor(getSeries(10),new Color(176,96,140));
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),8);
setPlaceResize(getPieSliceLabel(),0);
setFontSizeAbsolute(getPieLabel(),true);
setFontSizeInPoints(getPieLabel(),8);
setPlaceResize(getPieLabel(),0);
setFillColor(getSeries(0),new Color(118,101,188));
setFontStyle(getPieSliceLabel(),0);
setFontStyle(getPieLabel(),0);
setTransparentBorderColor(getChartBackground(),false);
setPieFeelerTextDisplay(1);
setRect(getPieFrame(),new Rectangle(-15520.0,-13672.0,36373.0,26084.0));
setTextString(getSubtitle(),"\n\n\n");
setTextString(getTitle()," \n");
setDisplay(getTitle(),true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE=HEADING, LINE=1, ITEM=1, OBJECT=TEXT, SIZE=10, STYLE=BOLD, FONT='ARIAL', JUSTIFY=CENTER, $
ENDSTYLE
END