Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] repeating the count for every record

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] repeating the count for every record
 Login/Join
 
Master
posted
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? Wink

THANKS!

This message has been edited. Last edited by: Kerry,


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
<JJI>
posted
Tom,

Try this:
 
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.

Hope this helps,
 
Report This Post
Master
posted Hide Post
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


Thanks!!!


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
<JJI>
posted
Tom,

Just for the fun of it. This code worked even before the "BYDISPLAY" command was introduced.
Smiler

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

Have fun,
 
Report This Post
Expert
posted Hide Post
Ahh, the days before "BYDISPLAY"... A lot has changed since then, hasn't it.

Keep in mind that, if the COUNTRY is not in the order that you want, you may need to add "BY COUNTRY NOPRINT" before your "BY CRCNT", as in:

PRINT
CAR
BY COUNTRY NOPRINT <-- here
BY CRCNT
BY COUNTRY <-- would we need this then?

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.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
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, 2007Report This Post
<JJI>
posted
quote:
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.
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] repeating the count for every record

Copyright © 1996-2020 Information Builders