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] COUNT of words which are seperated by a seperator

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] COUNT of words which are seperated by a seperator
 Login/Join
 
Member
posted
I need to do a count of individual words in a column which are seperated by ','. For Example if the column has value

word1, word2

the function should give me COUNT 2. Can this be achieved?

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.0.0.9
Linux 2.6.32-220.el6.x86_64
 
Posts: 9 | Registered: March 23, 2015Report This Post
Gold member
posted Hide Post
 
Posts: 64 | Location: North Carolina | Registered: December 04, 2007Report This Post
Member
posted Hide Post
That helped but problem is I am searching for words which cannot be predefined. How would I search for the words separated by a ',' and increase count for every word encountered?


WebFOCUS 8.0.0.9
Linux 2.6.32-220.el6.x86_64
 
Posts: 9 | Registered: March 23, 2015Report This Post
Member
posted Hide Post
ok I used the logic of counting the seperator and then incrementing the total count by 1 and that gives me the correct total. I think it is a temp solution? Is there a more concrete way? I used this

DEFINE FUNCTION COUNT_CHARS DESCRIPTION (CHAR/A1,STRING/A4000V)
_BEFORE/I4 = ARGLEN(4000,STRING,'I4');
STRIPPED/A4000V = STRIP(4000,STRING,CHAR,'A4000V');
_AFTER/I4 = ARGLEN(4000,STRIPPED,'I4');
COUNT_CHARS/I4 = _BEFORE - _AFTER + 1;
END


WebFOCUS 8.0.0.9
Linux 2.6.32-220.el6.x86_64
 
Posts: 9 | Registered: March 23, 2015Report This Post
Master
posted Hide Post
As far as I know, that is about as good as it gets.

DEFINE FUNCTION COUNT_CHARS DESCRIPTION (CHAR/A1,STRING/A4000V)
_BEFORE/I4 = ARGLEN(4000,STRING,'I4');
STRIPPED/A4000V = STRIP(4000,STRING,CHAR,'A4000V');
_AFTER/I4 = ARGLEN(4000,STRIPPED,'I4');
COUNT_CHARS/I4 = _BEFORE - _AFTER + 1;
END

DEFINE FILE CAR
MYVALUES/A200='1fff,2fff,3fff,4fff,5fff,6fff,7fff,8fff,9fff,10fff,11fff,12fff';
MYCOUNT/I4=COUNT_CHARS(',', MYVALUES);
FIELD9/A50=GETTOK(MYVALUES, 200, 9, ',', 50, 'A50');
FIELD10/A50=GETTOK(MYVALUES, 200, 10, ',', 50, 'A50');
FIELD11/A50=GETTOK(MYVALUES, 200, 11, ',', 50, 'A50');
END

TABLE FILE CAR
PRINT
     CAR.ORIGIN.COUNTRY NOPRINT
     MYVALUES
	 MYCOUNT
	 FIELD9
	 FIELD10
	 FIELD11
-*WHERE RECORDLIMIT EQ 1
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report 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] COUNT of words which are seperated by a seperator

Copyright © 1996-2020 Information Builders