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 have a stacked charted that needs the bars displayed from the longest total total to the least. I have reproduced this with the car file and have include it here. If you run it you will see that the bars are not displayed in order from the longest at the top to the shortest at the bottom. This chart also has a drill down so it would need to pass both country and car to the drilled down report.
Looking to see how you would handle this.
APP PREPENDPATH IBISAMP
GRAPH FILE CAR
SUM
DEALER_COST AS ''
BY CAR AS ''
ACROSS COUNTRY AS ''
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH HBRSTK1
ON GRAPH SET AUTOFIT ON
END
Scott WF8This message has been edited. Last edited by: TexasStingray,
This is something I often want to do and I haven't found a nice neat answer so far. This is the solution I use, hopefully someone will come up with something better.
TABLE FILE CAR
SUM
DEALER_COST
BY COUNTRY
ON TABLE HOLD
END
-RUN
TABLE FILE HOLD
SUM
CNT.COUNTRY NOPRINT
PRINT
COUNTRY NOPRINT
COMPUTE CNTR /I9 = LAST CNTR+1; NOPRINT
COMPUTE COLS /A300 = IF CNTR EQ CNT.COUNTRY THEN ''''|COUNTRY||'''' ELSE ''''|COUNTRY||''''|' AND';
BY HIGHEST DEALER_COST NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS COLS FORMAT ALPHA
END
-RUN
GRAPH FILE CAR
SUM
DEALER_COST AS ''
BY CAR AS ''
ACROSS COUNTRY AS '' COLUMNS
-INCLUDE COLS
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH HBRSTK1
ON GRAPH SET AUTOFIT ON
END
WF 7.6.11 Output: HTML, PDF, Excel
Posts: 123 | Location: UK | Registered: October 09, 2003
DEFINE FILE CAR
SDCOST/D7=DEALER_COST;
END
TABLE FILE CAR
SUM SDCOST NOPRINT
BY HIGHEST TOTAL SDCOST NOPRINT
BY COUNTRY
SUM DEALER_COST
BY HIGHEST TOTAL SDCOST
BY COUNTRY
BY CAR
ON TABLE HOLD
END
TABLE FILE HOLD
PRINT COUNTRY
COMPUTE RK/I1=IF COUNTRY EQ LAST COUNTRY THEN LAST RK ELSE LAST RK + 1;
CAR DEALER_COST
ON TABLE HOLD AS H1
END
DEFINE FILE H1
ACOUNTRY/A12=EDIT(RK) | ' ' | COUNTRY;
END
GRAPH FILE H1
SUM
DEALER_COST AS ''
BY CAR AS ''
ACROSS ACOUNTRY AS ''
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH HBRSTK1
ON GRAPH SET AUTOFIT ON
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
To augment the code from Danny, I thought that a method that allows you to modify the sort order by changing the data input. If you were to change DEALER_COST to SEATS or RETAIL_COST etc. the sort order should change -
DEFINE FILE CAR
SDCOST/D7 = DEALER_COST;
END
TABLE FILE CAR
SUM SDCOST NOPRINT
BY HIGHEST TOTAL SDCOST NOPRINT
BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS TEMPCOLS
END
-RUN
TABLEF FILE TEMPCOLS
PRINT COMPUTE COLS/A500V = IF LAST COLS EQ '' THEN 'COLUMNS ''' | COUNTRY || '''' ELSE LAST COLS || ' AND ''' | COUNTRY || '''';
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS COLLIST
END
-RUN
-* We need the last occurence of this output
-READ COLLIST NOCLOSE &X.A6 &Columns.A500
-REPEAT :Loop WHILE &IORETURN EQ 0;
-READ COLLIST NOCLOSE &X.A6 &Columns.A500
-:Loop
GRAPH FILE CAR
SUM DEALER_COST AS ''
BY CAR AS ''
ACROSS COUNTRY AS ''
-* This will force the countries to appear in the order that you want
&Columns.EVAL
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH HBRSTK1
ON GRAPH SET AUTOFIT ON
END
Or better still, make the column, that you are summating, a variable and input that into the DEFINE and the final report for an adaptable method.
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Thought I would post what I had done, it might not have been the best salution bit its what I came up with before the replys.
APP PREPENDPATH IBISAMP
TABLE FILE CAR
SUM
DEALER_COST AS 'TOTAL_DEALER_COST'
BY HIGHEST TOTAL DEALER_COST NOPRINT
BY COUNTRY
SUM
DEALER_COST
BY HIGHEST TOTAL DEALER_COST NOPRINT
BY COUNTRY
BY CAR
ON TABLE HOLD AS HOLD1
ON TABLE SET ASNAMES ON
ON TABLE SET HOLDLIST PRINTONLY
END
-*
FILEDEF LABELS DISK LABELS.FEX
TABLE FILE HOLD1
SUM
DEALER_COST NOPRINT
BY HIGHEST TOTAL DEALER_COST
BY HIGHEST COUNTRY
ON TABLE HOLD AS HOLDX
END
-*
TABLE FILE HOLDX
PRINT COUNTRY NOPRINT
AND COMPUTE CNTR1/I2 = LAST CNTR1 - 1; NOPRINT
AND COMPUTE GRLABEL/A70 = 'setGroupLabel(' | EDIT(CNTR1 + 1) | ', "' | COUNTRY | '");';
ON TABLE SAVE AS LABELS
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN
-*
DEFINE FILE HOLD1
CNTR/I2 = LAST CNTR + 1;
KEY/A256 = EDIT(TOTAL_DEALER_COST) | '|' | COUNTRY || '|';
END
GRAPH FILE HOLD1
SUM
MAX.DEALER_COST AS ''
AND COMPUTE COUNTRY/A16 = GETTOK(KEY, 256, 2, '|', 16, COUNTRY); NOPRINT
BY CAR AS ' '
ACROSS HIGHEST KEY AS ' '
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET 3D OFF
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH HBRSTK1
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
-MRNOEDIT BEGIN
-INCLUDE LABELS.FEX
-MRNOEDIT END
*END
ENDSTYLE
END