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 simple table req. using the CAR FILE which numbers the values when the country sort value changes.
DEFINE FILE CAR
CRCNT/I5 WITH COUNTRY = IF COUNTRY EQ LAST COUNTRY THEN CRCNT ELSE CRCNT + 1;
END
-*
TABLE FILE CAR
HEADING CENTER
"Try This Stuff"
" "
PRINT
CAR
BY CRCNT
BY COUNTRY
END
-RUN
-EXIT
As expected, I am getting this output:
CRCNT COUNTRY CAR 1 ENGLAND JAGUAR JENSEN TRIUMPH 2 FRANCE PEUGEOT 3 ITALY ALFA ROMEO MASERATI 4 JAPAN DATSUN TOYOTA 5 W GERMANY AUDI BMW
What I'd like to do is have report actually like this:
CRCNT COUNTRY CAR 1 ENGLAND JAGUAR 1 JENSEN 1 TRIUMPH 2 FRANCE PEUGEOT 3 ITALY ALFA ROMEO 3 MASERATI 4 JAPAN DATSUN 4 TOYOTA 5 W GERMANY AUDI 5 BMW
I have been trying LAST and not it is not quite working...
Any ideas?
THANKS!This message has been edited. Last edited by: Kerry,
DEFINE FILE CAR
CRCNT/I5 WITH COUNTRY = IF COUNTRY EQ LAST COUNTRY THEN CRCNT ELSE CRCNT + 1;
END
-*
TABLE FILE CAR
HEADING CENTER
"Try This Stuff"
" "
PRINT
CAR
BY CRCNT
BY COUNTRY
-*
ON TABLE SET BYDISPLAY ON
-*
END
-RUN
-EXIT
the code ON TABLE SET BYDISPLAY ON forces WF to display the repeating BY values. ON TABLE SET BYDISPLAY OFF is the default, so by not setting it the repeating BY values are not displayed.
Dirk your suggestion is AWESOME!!! I wrote more code to solve this problem, but I like yours better....
Here is my code for the old schoolers:
DEFINE FILE CAR
CRCNT/I5 WITH COUNTRY = IF COUNTRY EQ LAST COUNTRY THEN CRCNT ELSE CRCNT + 1;
-*
XCNT/I5 WITH COUNTRY = IF CRCNT EQ 1 AND COUNTRY NE LAST COUNTRY THEN 1
ELSE IF CRCNT EQ LAST CRCNT AND COUNTRY EQ LAST COUNTRY THEN XCNT
ELSE IF CRCNT GT 1 AND COUNTRY NE LAST COUNTRY THEN CRCNT ELSE 0;
END
-*
-*
TABLE FILE CAR
HEADING CENTER
"Try This Stuff"
" "
PRINT
XCNT AS '#'
CAR
-*
BY COUNTRY NOPRINT
ON TABLE PCHOLD FORMAT PDF
END
-RUN
Just for the fun of it. This code worked even before the "BYDISPLAY" command was introduced.
DEFINE FILE CAR CRCNT/I5 WITH COUNTRY = IF COUNTRY EQ LAST COUNTRY THEN CRCNT ELSE CRCNT + 1; END -* TABLE FILE CAR HEADING CENTER "Try This Stuff" " " PRINT CRCNT COUNTRY CAR BY CRCNT NOPRINT BY COUNTRY NOPRINT -* END -RUN -EXIT
The following code does exactly what you wanted to do according to your first post:
TABLE FILE CAR
HEADING CENTER
"Try This Stuff"
" "
PRINT
COMPUTE CRCNT/I5 WITH COUNTRY = IF COUNTRY EQ LAST COUNTRY THEN CRCNT ELSE CRCNT + 1; AS '#'
COMPUTE CRCNTRY/A10 WITH CAR = IF COUNTRY EQ LAST COUNTRY THEN ' ' ELSE COUNTRY; AS 'COUNTRY'
CAR
BY COUNTRY NOPRINT
BY CRCNT NOPRINT
END
Hope this helps ...
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
Thanks JJI, for the FUN reminder. It's good to keep those old methods in mind. It helps us to realize how far we've come and how far we can go.
Hi Doug, Thanks for your appreciation. These oldies come in handy from time to time and make sometimes the difference in getting the report you want or not. That's why I like this forum so much. We can all learn from each other and this forum can also inspire the developers to further improve the WF products.