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.
Requirement I have is to show variance percentages after counts. Not side by side. See code below and image. I am trying to achieve this with a basic table request. I tried to do a multi verb across but its not working. Maybe we can't do a multi-verb across? Looks like I am going to have to pull variance columns seperately hold them and then MORE the data using dummy regions to achieve this. Another issue is that the regions are coming from user input. They can pick from 1 to 5 regions. So the report output is dependent on what the user selects. This report is being developed in 7.7.03 and HTML,PDF,EXL2K output. Any thoughts?
SET ASNAMES = ON
SET HOLDLIST = PRINTONLY
SET CENT-ZERO = ON
SET ACROSSLINE = OFF
DEFINE FILE GGSALES
REGION_ORDER/I11 = DECODE REGION('Midwest' 1 'Northeast' 2 'Southeast' 3 'West' 4 ELSE 99);
END
TABLE FILE GGSALES
SUM
UNITS
BY PRODUCT
BY REGION_ORDER
BY REGION
ON TABLE HOLD AS HDATA
END
-RUN
TABLE FILE HDATA
SUM
UNITS AS 'PRIMARY'
BY PRODUCT
WHERE REGION EQ 'Midwest'
ON TABLE HOLD AS HPRIMARY
END
-RUN
JOIN PRODUCT IN HDATA TO
PRODUCT IN HPRIMARY AS J0
END
-RUN
TABLE FILE HDATA
SUM
UNITS
COMPUTE VARIANCE/D12.2 = IF UNITS EQ 0 THEN 0 ELSE ((PRIMARY - UNITS)/UNITS) * 100;
BY REGION_ORDER
BY REGION
BY PRODUCT
ON TABLE HOLD AS HRPTDATA
END
-RUN
TABLE FILE HRPTDATA
SUM
UNITS AS 'Units'
-*ACROSS REGION_ORDER NOPRINT
-*ACROSS REGION
-*BY PRODUCT
-*SUM
VARIANCE AS '% Variance vs Primary'
ACROSS REGION_ORDER NOPRINT
ACROSS REGION AS ''
BY PRODUCT AS 'Product'
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END
-RUN
This message has been edited. Last edited by: Mighty Max,
Waz is right. This does not seem feasible with a single table request but playing around with HOLD files and a bit of dynamic formatting this may work:
SET ASNAMES = ON
SET HOLDLIST = PRINTONLY
SET CENT-ZERO = ON
SET ACROSSLINE = OFF
SET LINES = 999999
DEFINE FILE GGSALES
REGION_ORDER/I11 = DECODE REGION('Midwest' 1 'Northeast' 2 'Southeast' 3 'West' 4 ELSE 99);
END
TABLE FILE GGSALES
SUM
UNITS
BY PRODUCT
BY REGION_ORDER
BY REGION
ON TABLE HOLD AS HDATA
END
-RUN
TABLE FILE HDATA
SUM
UNITS AS 'PRIMARY'
BY PRODUCT
WHERE REGION EQ 'Midwest'
ON TABLE HOLD AS HPRIMARY
END
-RUN
FILEDEF HRESULTS DISK hresults.ftm (APPEND
-RUN
-*** Capture UNITS ***
DEFINE FILE HDATA
DATA_GRP/A10 = 'UNITS';
DATA_LBL/A30 = 'Units';
END
TABLE FILE HDATA
PRINT
UNITS/D12.2 AS 'RESULT'
BY DATA_GRP
BY DATA_LBL
BY PRODUCT
BY REGION_ORDER
BY REGION
ON TABLE HOLD AS HRESULTS
END
-RUN
-*** Capture VARIANCE ***
JOIN PRODUCT IN HDATA TO
PRODUCT IN HPRIMARY AS J0
END
-RUN
DEFINE FILE HDATA
DATA_GRP/A10 = 'VARIANCE';
DATA_LBL/A30 = '% Variance vs Primary';
END
TABLE FILE HDATA
SUM
COMPUTE VARIANCE/D12.2 = IF UNITS EQ 0 THEN 0 ELSE ((PRIMARY - UNITS)/UNITS) * 100; AS 'RESULT'
BY DATA_GRP
BY DATA_LBL
BY PRODUCT
BY REGION_ORDER
BY REGION
ON TABLE HOLD AS HRESULTS
END
-RUN
-*** Produce report ***
DEFINE FILE HRESULTS
RSLT_FMT/A8 = IF DATA_GRP EQ 'UNITS' THEN 'D12' ELSE 'D12.2';
END
TABLE FILE HRESULTS
SUM
RESULT/RSLT_FMT AS ''
ACROSS DATA_GRP NOPRINT
ACROSS REGION_ORDER NOPRINT
ACROSS REGION AS ''
ACROSS DATA_LBL AS ''
BY PRODUCT AS 'Product'
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END
-RUN
Titles don't show exactly as your sample output but hopefully they are close enough. The ACROSS statements could be changed to something like the following for a slightly different effect:
ACROSS DATA_GRP NOPRINT
ACROSS DATA_LBL AS ''
ACROSS REGION_ORDER NOPRINT
ACROSS REGION AS ''