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.
Hi, I have a fex, with COMPUTE fields. Is it possible in TOTAL and SUBTOTAL to just sum some of them and to recompute some of them.
COMPUTE HOUSEWARES/D14.2S=(HSWCOST_P_PAGE * BUDGET); AS 'Cost Housewares' COMPUTE HOUSEWARESLY/D14.2S=(HSWCOST_P_PAGELY * BUDGETLY); AS 'Cost Housewares LY' COMPUTE D_HOUSEWARES/D8.2=(HOUSEWARES-HOUSEWARESLY); AS 'Difference' V_HOUSEWARES/D8.2%=IF (HOUSEWARESLY EQ 0 AND HOUSEWARES NE 0) THEN 100 ELSE IF (HOUSEWARESLY EQ 0) THEN 0 ELSE (D_HOUSEWARES/HOUSEWARESLY)*100; AS 'Page Variance'
F.e to sum HOUSEWARES HOUSEWARESLY and to do recompute D_HOUSEWARES V_HOUSEWARES
I need to have them in one like all for the same sort break.
that is what SUMMARIZE will do. Add the numeric verb object columns and recompute any computed fields. You can find more info on the topic on the IBI web site. loo k under publications/topics/summarize.
Posts: 11 | Location: Information Builders Inc | Registered: April 15, 2005
The following request illustrates the use of SUMMARIZE to recalculate DG_RATIO at the specified sort break, DEPARTMENT, and for the higher-level sort break, PAY_DATE:
TABLE FILE EMPLOYEE SUM GROSS DED_AMT COMPUTE DG_RATIO/F4.2=DED_AMT/GROSS; BY HIGHEST PAY_DATE BY DEPARTMENT BY BANK_ACCT WHERE BANK_ACCT NE 0 ON DEPARTMENT SUMMARIZE END
The first and last portions of the output are:
PAY_DATE DEPARTMENT BANK_ACCT GROSS DED_AMT DG_RATIO
*TOTAL DEPARTMENT PRODUCTION $6,055.50 $3,695.55 .61
*TOTAL PAY_DATE 82/08/31 $11,665.50 $7,350.98 .63
The report output may look a little off being posted here, however the point is, the code sums GROSS and DED_AMT and recalculates the average. If you did not want a grand total the matching command to this is RECOMPUTE.
Posts: 11 | Location: Information Builders Inc | Registered: April 15, 2005
I think we are over simplifying Sanders question. The problem is that the fields Sanders would like to have SUMed are COMPUTE fields, not database fields, which use HSW and BUDGET figures. What Sanders would like to do is SUM the results of the individual calculations instead of SUMing HSW and BUDGET values and then REcalcualting in the subtotal line with the aggregated values for HSW and BUDGET. You will achieve different results depending on if you use SUBTOTAL or SUMMARIZE.
SUBTOTAL calculates the COMPUTEd fields first and then SUMs the results.
SUMMERIZE SUMs the fields used in the calculation first and then calculates the COMPUTE fields in the total line.
The problem is that Sanders would like to do SUBTOTAL for two fields and then SUMMERIZE for the other two. SUBTOTAL and SUMMERIZE calculate the COMPUTE fields at different stages.
I am working on an example with the CAR file. Hopefully I will find a graceful solution.
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003
I think I understand what you want to do. I ran into something similar. Here is some code using CAR.
TABLE FILE CAR
SUM
COMPUTE DEALER/D20.2 = DEALER_COST + 1;
COMPUTE RETAIL/D20.2 = RETAIL_COST +1;
COMPUTE PERC/D8.2% = DEALER_COST/RETAIL_COST;
SALES
BY COUNTRY
BY CAR
ON COUNTRY SUBTOTAL SALES RECOMPUTE DEALER RETAIL PERC
END
-EXIT
Posts: 15 | Location: Atlanta | Registered: July 19, 2005
Change the COMPUTEs for HOUSEWARES and HOUSEWARESLY to DEFINEs and leave the other two as COMPUTEs. Then use the RECOMPUTE command to get your subtotal lines.
Making these two into DEFINEs will change the way they are treated by the RECOMPUTE and therefore get you what you are looking for.
Here is some code using the CAR file which illustrates the solution.
DEFINE FILE CAR BUDGET/D12=DECODE BODYTYPE(SEDAN 1200 HARDTOP 300 COUPE 800 ELSE 500); BUDGETLY/D12=DECODE BODYTYPE(SEDAN 120 HARDTOP 30 COUPE 80 ELSE 50); HSW/D20=RCOST * BUDGET; HSWLY/D20=DCOST * BUDGETLY; END
TABLE FILE CAR PRINT HSW HSWLY COMPUTE HSWDF/D20=HSW - HSWLY; COMPUTE PCTDF/D8.2%=IF (HSWLY EQ 0) AND (HSW NE 0) THEN 100 ELSE IF (HSWLY EQ 0) THEN 0 ELSE (HSWDF / HSW) * 100; AS '% DF' BY COUNTRY BY CAR BY MODEL BY BODYTYPE WHERE COUNTRY NE 'FRANCE' OR 'W GERMANY' ON COUNTRY RECOMPUTE ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF,$ TYPE=SUBTOTAL, BACKCOLOR=YELLOW,$ ENDSTYLE END
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003
Thank you for a beautiful solution. Works perfect. I had to call IBI before I saw your solution. There is another way to do it SET SUMMARY=EXPLICIT allows to do each field separately. SET SUMMARY=EXPLICIT
DEFINE FILE CAR BUDGET/D12=DECODE BODYTYPE(SEDAN 1200 HARDTOP 300 COUPE 800 ELSE 500); BUDGETLY/D12=DECODE BODYTYPE(SEDAN 120 HARDTOP 30 COUPE 80 ELSE 50); END
TABLE FILE CAR PRINT HSW HSWLY COMPUTE HSW/D20=RCOST * BUDGET; COMPUTE HSWLY/D20=DCOST * BUDGETLY; COMPUTE HSWDF/D20=HSW - HSWLY; COMPUTE PCTDF/D8.2%=IF (HSWLY EQ 0) AND (HSW NE 0) THEN 100 ELSE IF (HSWLY EQ 0) THEN 0 ELSE (HSWDF / HSW) * 100; AS '% DF' BY COUNTRY BY CAR BY MODEL BY BODYTYPE WHERE COUNTRY NE 'FRANCE' OR 'W GERMANY' ON COUNTRY RECOMPUTE HSWDF PCTDF ON COUNTRY SUBTOTAL HSW HSWLY ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF,$ TYPE=SUBTOTAL, BACKCOLOR=YELLOW,$ ENDSTYLE END
Sander, I saw the SET SUMMARY=EXPLICIT in the reporting manual but all the examples used SUBTOTAL and RECOMPUTE each on a different sort field so I didn't think it would work. I never did test it.
Your report is one of those types of requests that causes you to learn a bit more about the order of processing. I use to work for IBI as a consultant in the Washington DC area and use to teach FOCUS classes which give you many insights into the order of how each part is processed.
SET SUMMARY=EXPLICIT is a nice feature that was added in 5.x I think.
I'm glad you finally have a solution or two.
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003