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 to create a report and in the subtotal I must put also the number of rows that were counted in the sous-total. The report must look like this: COL1 COL2 COL3 A 1 20 A 2 10 ---------------------------- SubTotal A(2) 3 30
B 2 15 B 3 25 B 1 10 --------------------------- SubTotal B(3) 6 50
I tried to use a count , something like that:
TABLE FILE TBL COL2 COL3 COMPUTE VAR= CNT.COL1 BY COL1 ON TABLE SUBTOTAL COL1 AS 'SubTotal But it didn't work. Is it possible to do this? Thanks for your responses, Andreea
Thanks for your response, but it didn't help me because I can't get the report as I want it: If I use: BY COL1 COMPUTE VAR=CNT.COL1 I get an error message, because I can't use CNT in BY. And, If I try the second solution : ON COL1 SUBFOOT "subtotal (I get the first part of the result that I expected( Subtotal A(2) ) but I can't get the rest of the subtotal for the columns COL2 and COL3. I forgot to say that my report must also contain a final total : COL1 COL2 COL3 A 1 20 A 2 10 ------------------- SubTotal A(2) 3 30
B 2 15 B 3 25 B 1 10 ------------------- SubTotal B(3) 6 50 TOTAL (5) 9 80
TABLE FILE CAR
SUM COMPUTE CTRY_CNT/I9 WITH COUNTRY = 1; NOPRINT
BY COUNTRY
SUM RCOST DCOST
BY COUNTRY
BY CAR
ON COUNTRY SUBFOOT
"Subtotal <COUNTRY (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST"
ON TABLE SUBFOOT
"Total (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST"
END
Edited because I forgot the Total row for you.
TThis message has been edited. Last edited by: Tony A,
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
Hello Tony, Thanks for your support; It works fine right now, as I want it. I have only one thing that's not OK: the result of the subtotal isn't right; I get always the CTRY_CNT = 1; If I have 3 record for country=X, I need to have CTRY_CNT = 3. The Total works fine; it makes the sum of the values which was found in the subtotal fields.
TABLE FILE CAR
SUM COMPUTE CTRY_CNT/I9 WITH CAR = 1; NOPRINT
BY COUNTRY
BY CAR
SUM RCOST DCOST
BY COUNTRY
BY CAR
ON COUNTRY SUBFOOT
"Subtotal <COUNTRY (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST"
ON TABLE SUBFOOT
"Total (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST"
END
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
Hello, If I use the syntax: TABLE FILE CAR SUM COMPUTE CTRY_CNT/I9 WITH CAR = 1; NOPRINT BY COUNTRY BY CAR SUM RCOST DCOST BY COUNTRY BY CAR ON COUNTRY SUBFOOT "Subtotal ... ) ON TABLE SUBFOOT "Total .....() END I get an report with subtotal after each rows, something like that:
In another case, if I use the syntax: TABLE FILE CAR SUM COMPUTE CTRY_CNT/I9 WITH COUNTRY = 1; NOPRINT BY COUNTRY SUM RCOST DCOST BY COUNTRY BY CAR ON COUNTRY SUBFOOT "Subtotal ... ) ON TABLE SUBFOOT "Total .... () END I get one result like that(The subtotal isn't right): COUNTRY CAR RCOST DCOST Country1 Car1 2 3 Country1 Car2 1 2 ---------------------------- Subtotal Country1(1) 3 5
As you can see, no one of the solutions help me get the report as I want it; I want my report to be something like that(in red is what I want to get from my report): COUNTRY CAR RCOST DCOST Country1 Car1 2 3 Country1 Car2 1 2 ---------------------------- Subtotal Country1(2) 3 5 Country2 Car2 5 3 Country2 Car3 2 4 Country2 Car4 1 3 ---------------------------- Subtotal Country2(3) 8 10 Total(5) 11 15
It's any other method that I can use to create that subtotal as I want? Thanks a lot for your responses,
AndreeaThis message has been edited. Last edited by: <Andr33a>,
Your are complicating your code unnecessarily. You do not need to do a multi-verb request. Try the following.
TABLE FILE CAR SUM RCOST DCOST COMPUTE CTRY_CNT/I9 WITH CAR = 1; NOPRINT BY COUNTRY BY CAR ON COUNTRY SUBFOOT "Subtotal <COUNTRY [<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST" ON TABLE SUBFOOT "Total (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST" ENDThis message has been edited. Last edited by: mgrackin,
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003
Hello, Tony, you are right; The code that you post it gives the same output as the code posted by Mickey, but it's not the output I want to have. Using your codes I get the output exactly like that:
And I don't want to have a subtotal after every type of the car; I want to have a subtotal by the country and in the parantheses I must get the number of the cars that are in the country that I used as the tri field. It means I want something like this:
Thanks a lot for yours support; I'll try find a way to make that report and if I find a solution I will post it to the forum. If you have other options/sugestions I will be glad to received them.
Andreea
PS: I forgot to mention that I need to use PRINT for the rest of the columns, because I have more lignes that must be printed into the output; So I used SUM for the subtotal : SUM COMPUTE CTRY_CNT/I9 WITH CAR = 1; NOPRINT BY COUNTRY BY CAR and PRINT for the rest of the columns: PRINT RCOST DCOST BY COUNTRY BY CARThis message has been edited. Last edited by: <Andr33a>,
The following code gives you SUBTOTALs just on Country which seems to be what you are looking for. This is basically the code I posted last week. May be we do not quite understand what you are trying to do.
TABLE FILE CAR SUM RCOST DCOST COMPUTE CTRY_CNT/I9 WITH CAR = 1; NOPRINT BY COUNTRY BY CAR ON TABLE SET HTMLCSS ON ON COUNTRY SUBFOOT "---------------------------------------------------" "Subtotal <COUNTRY (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST" ON TABLE SUBFOOT "---------------------------------------------------" "---------------------------------------------------" "Total (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST" ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, FONT='COURIER',$ ENDSTYLE END
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003
TABLE FILE CAR PRINT RCOST DCOST COMPUTE CTRY_CNT/I9=IF (COUNTRY EQ LAST COUNTRY) AND (CAR EQ LAST CAR) THEN 0 ELSE 1; NOPRINT BY COUNTRY BY CAR ON TABLE SET HTMLCSS ON ON COUNTRY SUBFOOT "--------------------------------------------------" "Subtotal <COUNTRY (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST</2" ON TABLE SUBFOOT "--------------------------------------------------" "--------------------------------------------------" "Total (<ST.CTRY_CNT<+0>) <ST.RCOST <ST.DCOST" ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, FONT='COURIER',$ ENDSTYLE END
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003
Thanks Tony, Mickey,for your infos; The mistake was made in my report, because in SUM I put a condition and in PRINT I put the conditions in another order, and It seems that this was the problem. Thanks again and have a nice day,
FYI, Multi-Verb (SUM, PRINT) requests such as yours should only have one set of selection statements and they should all be after the last verb, which in your case is PRINT.
I'm insterested to see a CAR FILE example of your request with seelction statements in different places and in a different order.
I'm also not clear as to why you need to do a Multi-Verb request. But if it's working, GREAT!
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003