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.
I am doing a sum of the count of the ID numbers in the table sorted by two defined fields.
For example: In the table I have two columns payment and ID number.
I need to define the payment for different categories. define file xyz PAYLVL/A20 = IF PAYMENT LT 3000 THEN 'AVERAGE' ELSE IF PAYMENT FROM 3001 TO 4000 THEN 'ABOVE AVERAGE' ELSE IF PAYMENT FROM 4001 TO 5000 THEN 'HIGH1' ELSE IF PAYMENT GT 5000 THEN 'HIGH2' ELSE '???'; EXPLVL/A20 = DECODE PAYLVL('AVERAGE' 'SENR' 'ABOVE AVERAGE' 'MNGR' 'HIGH1' 'EXTV' 'HIGH2' 'EXTV' ELSE '???'); END
TABLE FILE XYZ SUM CNT.ID_NBR PAYMENT BY EXPLVL BY PAYLVL END
In this example for CNT.ID_NBR for payment level HIGH2 there are no records. so, the CNT.ID_NBR is 0 and PAYMENT is 0 so, the final output I am getting is: EXTV HIGH1 3 15000 MNGR ABOVE AVERAGE 1 .. SENR AVERAGE ...
I need to get the output as follows: EXTV HIGH2 0 0 EXTV HIGH1 3 15000
since the count is 0 and payment is 0 I am not getting the record at all. How do I get the output to display 0 even if there are no records?
Thanks Tony A and FrankDutch for the quick reply. But both these solutions are not working for me. I am still not getting the row for zero records. How do I make the report display for Zero records with the other defined values?
Yes it is difficult to display a missing record. However almost anything is possible in Focus. Try this:
-* this is to create an example of your file
TABLE FILE CAR
LIST SALES
ON TABLE HOLD
END
DEFINE FILE HOLD
PAYLVL/A20 = IF SALES LT 10000 THEN 'AVERAGE' ELSE
IF SALES FROM 10001 TO 20000 THEN 'ABOVE AVERAGE' ELSE
IF SALES FROM 20001 TO 50000 THEN 'HIGH1' ELSE
IF SALES GT 50000 THEN 'HIGH2' ELSE '???';
END
-* this creates the line of missing values
TABLE FILE HOLD
PRINT LIST SALES
BY PAYLVL ROWS 'AVERAGE' OVER 'ABOVE AVERAGE' OVER 'HIGH1' OVER 'HIGH2'
ON TABLE HOLD AS HOLD1
ON TABLE SET HOLDMISS ON
END
DEFINE FILE HOLD1
EXPLVL/A20 = DECODE E01('AVERAGE' 'SENR'
'ABOVE AVERAGE' 'MNGR'
'HIGH1' 'EXTV'
'HIGH2' 'EXTV' ELSE '???');
END
-* this displays
TABLE FILE HOLD1
SUM CNT.LIST
SALES
BY EXPLVL
BY E01 AS PAYLVL
END
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
FYI: 1. You cannot have 2 sort levels in GRAPH 2. You cannot have 2 scales in PYRAMID
My suggestion: 1. Concatenate the fields PAYLVL, EXPLVL 2. Scale the PAYMENT field (in my example SALES) to the count otherwise the count pyramid will be squashed.
SET ASNAMES=ON
TABLE FILE CAR
LIST SALES
ON TABLE HOLD
END
DEFINE FILE HOLD
PAYLVL/A20 = IF SALES LT 10000 THEN 'AVERAGE' ELSE
IF SALES FROM 10001 TO 20000 THEN 'ABOVE AVERAGE' ELSE
IF SALES FROM 20001 TO 50000 THEN 'HIGH1' ELSE
IF SALES GT 50000 THEN 'HIGH2' ELSE '???';
END
TABLE FILE HOLD
PRINT LIST AS NUM
SALES
BY PAYLVL ROWS 'AVERAGE' OVER 'ABOVE AVERAGE' OVER 'HIGH1' OVER 'HIGH2'
ON TABLE HOLD AS HOLD1
ON TABLE SET HOLDMISS ON
END
DEFINE FILE HOLD1
EXPLVL/A20 = DECODE E01('AVERAGE' 'SENR'
'ABOVE AVERAGE' 'MNGR'
'HIGH1' 'EXTV'
'HIGH2' 'EXTV' ELSE '???');
LEVELS/A40 = EXPLVL | E01;
END
TABLE FILE HOLD1
SUM CNT.NUM
SUM.SALES
ON TABLE SAVE
END
-RUN
-READ SAVE &MNUM.A5. &MSALES.A6.
-SET &R=INT((&MSALES / &MNUM) / 10000) * 10000;
-TYPE &MNUM &MSALES &R
-GOTO A
TABLE FILE HOLD1
SUM
CNT.NUM
COMPUTE SAL&R/D6c= SALES / &R; AS 'SALES,&R.s'
BY EXPLVL
BY E01 AS 'PAYLVL'
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
GRAPHTYPE=DATA,
COLUMN=N3,
GRAPHLOOK=BAR,
GRAPHCOLOR=RED,
$
GRAPHTYPE=DATA,
COLUMN=N4,
GRAPHLOOK=BAR,
GRAPHCOLOR=BLUE,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
$
TYPE=DATA,
COLUMN=N3,
COLOR='RED',
$
TYPE=DATA,
COLUMN=N4,
COLOR='BLUE',
$
ENDSTYLE
END
-EXIT
-A
GRAPH FILE HOLD1
SUM CNT.NUM
COMPUTE SAL&R/D6c= SALES / &R; AS 'SALES,&R.s'
ACROSS LEVELS
ON GRAPH SET LOOKGRAPH 3DPYRAMD
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRID OFF
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHSTYLE *
setMarkerDisplay(true);
setConnectLineMarkers(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(false);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
setSeriesType(0,2);
setAxisAssignment(1,1);
setSeriesType(1,2);
setY1LabelDisplay(true);
setY1AxisSide(0);
setY1MajorGridDisplay(false);
setY1MinorGridDisplay(false);
setTextFormatPreset(getY1Label(),-1);
setTextFormatPattern(getY1Label(),"#.##");
setY2LabelDisplay(true);
setY2AxisSide(1);
setY2MajorGridDisplay(false);
setY2MinorGridDisplay(false);
setTextFormatPreset(getY2Label(),-1);
setTextFormatPattern(getY2Label(),"#.##");
setPieFeelerTextDisplay(1);
setPieLabelDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setRiserBorderMode(1);
setSeriesDefaultTransparentBorderColor(true);
setUseSeriesBorderDefaults(true);
setLegendDisplay(true);
setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setFontSizeAbsolute(getO1Title(),true);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
PAGESIZE='Letter',
LEFTMARGIN=0.250000,
RIGHTMARGIN=0.250000,
TOPMARGIN=0.250000,
BOTTOMMARGIN=0.250000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
BACKCOLOR='NONE',
STYLE=NORMAL,
$
TYPE=DATA,
ACROSSCOLUMN=N1,
COLOR='RED',
$
TYPE=DATA,
ACROSSCOLUMN=N2,
COLOR='BLUE',
$
ENDSTYLE
END
Good Luck!
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
1. In the fex there are 2 outputs, one a report and one a graph. Since you can't see both unless you insert them in some HTML and i wanted RB to see the graph, I skip over the report part directly to the graph part with -GOTO A.
2. The values of SALES are much larger that the count. So, in order to see 2 pyramids, I scale down the SALES by dividing by &R. Say that &R is 1000, then I wanted the title to be 'SALES,1000s'. The '.s' separates the 's' from the variable &R.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006