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.
Stupidly I wiped my original post but in essence it was to have suppressed row-totals except for the last row of each sort. David B. below came up with a good workable solution but the technique doesn't seem to work for FORMAT EXL07.This message has been edited. Last edited by: Ian Dalton,
_______________________ *** WebFOCUS 8.1.05M ***
Posts: 196 | Location: London, UK | Registered: December 06, 2005
DEFINE FILE CAR
PROFIT = RCOST - DCOST;
NEWPROFIT/D12 = IF CAR EQ 'MASERATI' OR 'TRIUMPH' THEN PROFIT ELSE 0;
END
TABLE FILE CAR
PRINT RCOST DCOST PROFIT
AND COMPUTE CUMPROF = IF COUNTRY EQ LAST COUNTRY THEN NEWPROFIT + LAST CUMPROF ELSE NEWPROFIT;
BY COUNTRY
BY CAR
WHERE COUNTRY EQ 'ENGLAND' OR 'ITALY';
END
In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005
You gave the answer yourself: "I don't know what the last row's value is going to be".
That's exactly the problem. WF doesn't whether it's the last BY within a major BY.
I don't think you could fix it with one pass...
There are serveral solutions with more that one pass.
• First query, resort reverse, mark first row, rereverse and report. • First query the BY-fields, determine the 'last', match that to other dataset and use it as an indicator where to show the ***. • First query data per row. Second query only by major BY. Match there with PRINT LST. • etc.
G'luck, Dave
_____________________ WF: 8.0.0.9 > going 8.2.0.5
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010
The following code additions to your model, might get you closer to your requirements:
APP PREPENDPATH IBISAMP
SET WIDTH = 200, PANEL=200
DEFINE FILE CAR
PROFIT = RCOST - DCOST;
END
TABLE FILE CAR
SUM SUM.PROFIT NOPRINT
BY COUNTRY NOPRINT
SUM LST.CAR WITHIN COUNTRY NOPRINT
BY COUNTRY NOPRINT
BY CAR NOPRINT
PRINT RCOST DCOST PROFIT
AND COMPUTE CUMPROF = IF COUNTRY EQ LAST COUNTRY THEN PROFIT + LAST CUMPROF ELSE PROFIT;
AND COMPUTE IANPROF/D12.2S = IF LST.CAR EQ CAR THEN C1 ELSE 0;
BY COUNTRY
BY CAR
WHERE COUNTRY EQ 'ENGLAND' OR 'ITALY';
ON TABLE SET ONLINE-FMT STANDARD
END
-EXIT
Similar technique, with the same results, that might align with your datasource better:
APP PREPENDPATH IBISAMP
SET WIDTH = 200, PANEL=200
DEFINE FILE CAR
PROFIT = RCOST - DCOST;
END
TABLE FILE CAR
SUM PROFIT NOPRINT
CNT.BODYTYPE NOPRINT
BY COUNTRY
PRINT RCOST DCOST PROFIT
AND COMPUTE CUMPROF = IF COUNTRY EQ LAST COUNTRY THEN PROFIT + LAST CUMPROF ELSE PROFIT;
AND COMPUTE ROWNUM = IF COUNTRY EQ LAST COUNTRY THEN ROWNUM + 1 ELSE 1; NOPRINT
AND COMPUTE IANPROF/D12.2S = IF C2 EQ ROWNUM THEN C1 ELSE 0;
BY COUNTRY
BY CAR
BY BODYTYPE NOPRINT
WHERE COUNTRY EQ 'ENGLAND' OR 'ITALY';
ON TABLE SET ONLINE-FMT STANDARD
END
-EXIT
Hi David and Dave, Many thanks - both good workable solutions. Sadly nothing is simple as when I showed my results to our users they want the cumulative figure (IANPROF) to be shown as blank except for the last row per country (which we have) but when the ***. total is actually zero, they need this to be 0.00 and NOT blank as the format of D12.2S suppresses this. Ian
_______________________ *** WebFOCUS 8.1.05M ***
Posts: 196 | Location: London, UK | Registered: December 06, 2005
Your users have a prefectly reasonable request for an amendment:
APP PREPENDPATH IBISAMP
SET WIDTH = 200, PANEL=200
DEFINE FILE CAR
TAXRATE = DECODE COUNTRY ('ENGLAND' 1
'ITALY' 0);
PROFIT = RCOST - DCOST - ((RCOST - DCOST) * TAXRATE);
END
TABLE FILE CAR
SUM PROFIT NOPRINT
CNT.BODYTYPE NOPRINT
BY COUNTRY
PRINT RCOST DCOST PROFIT
COMPUTE CUMPROF = IF COUNTRY EQ LAST COUNTRY THEN PROFIT + LAST CUMPROF ELSE PROFIT;
COMPUTE ROWNUM = IF COUNTRY EQ LAST COUNTRY THEN ROWNUM + 1 ELSE 1; NOPRINT
COMPUTE MYFORMAT/A8 = IF C2 EQ ROWNUM THEN 'D12.2' ELSE 'D12.2S'; NOPRINT
COMPUTE IANPROF/D12.2C = IF C2 EQ ROWNUM THEN C1 ELSE 0; NOPRINT
IANPROF/MYFORMAT
BY COUNTRY
BY CAR
BY BODYTYPE NOPRINT
WHERE COUNTRY EQ 'ENGLAND' OR 'ITALY';
ON TABLE SET ONLINE-FMT STANDARD
END
-EXIT
Thanks chaps - both good suggestions - I was hoping that a variable format was a solution and appears it is - I knew it could be done with DM but was unsure using COMPUTE. My users will no doubt be thrilled !!
_______________________ *** WebFOCUS 8.1.05M ***
Posts: 196 | Location: London, UK | Registered: December 06, 2005
We have just upgraded to WFS 7.7.05 and now get FORMAT EXL07 working correctly with multi-tab output but we are now finding that the variable format technique discussed earlier in this post/topic no longer works for FORMAT EXL07 - causes EDASERVE to crash. However for other output FORMATs all ok. Any suggestions ? Here is the code.....
TABLE FILE CAR SUM RCOST DCOST COMPUTE MYFMT/A8 = IF RCOST GT 10000 THEN 'P15.2CL' ELSE 'P15.2CS'; NOPRINT COMPUTE TESTER/P15.2C = RCOST-DCOST; TESTER/MYFMT AS 'VARFORMAT'
BY COUNTRY BY CAR ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT EXL07 -*ON TABLE PCHOLD FORMAT HTML END -EXIT
_______________________ *** WebFOCUS 8.1.05M ***
Posts: 196 | Location: London, UK | Registered: December 06, 2005
Sadly no Susannah because the HOLD file can only have one format per field. What I am trying to do is have a field format as either x or y depending on the contents of the field.
_______________________ *** WebFOCUS 8.1.05M ***
Posts: 196 | Location: London, UK | Registered: December 06, 2005
I got this working by using MISSING rather than a variable FORMAT which according to IBI is NOT supported as yet with EXL07. Here is the workaround....
SET WIDTH = 200, PANEL=200, NODATA = ' ' DEFINE FILE CAR TAXRATE = DECODE COUNTRY ('ENGLAND' 1 'ITALY' 0); PROFIT = RCOST - DCOST - ((RCOST - DCOST) * TAXRATE); END TABLE FILE CAR SUM PROFIT NOPRINT CNT.BODYTYPE NOPRINT BY COUNTRY PRINT RCOST DCOST PROFIT COMPUTE CUMPROF = IF COUNTRY EQ LAST COUNTRY THEN PROFIT + LAST CUMPROF ELSE PROFIT; COMPUTE ROWNUM = IF COUNTRY EQ LAST COUNTRY THEN ROWNUM + 1 ELSE 1; NOPRINT COMPUTE IANPROF/D12.2C MISSING ON = IF C2 EQ ROWNUM THEN C1 ELSE MISSING; BY COUNTRY BY CAR BY BODYTYPE NOPRINT WHERE COUNTRY EQ 'ENGLAND' OR 'ITALY'; ON TABLE PCHOLD FORMAT EXL07
END
_______________________ *** WebFOCUS 8.1.05M ***
Posts: 196 | Location: London, UK | Registered: December 06, 2005