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.
Hello, is there a function to find a specific word in a string and to count it. i need this for a flexible html-form. in the form i want to make a drilldown on a specific coloum, but the coloumnumber is flexible.
thanks a lotThis message has been edited. Last edited by: Kerry,
WF Production Version: 7.7.02M WF Test Version: 7.7.02M Developer Studio: 7.7.02 HTML, EXL2K, FLEX, PDF,PPT
is there a function to find a specific word in a string
Look up the POSIT function, it does just that.
quote:
and to count it
Now that's a different thing. WebFocus does not have any standard procedure that can do that for you. So you'll have to think up some workaround to get the count. Search this forum for that, I'm sure there is some thread that can give you a hint on how to do that.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
Now that's a different thing. WebFocus does not have any standard procedure that can do that for you. So you'll have to think up some workaround to get the count. Search this forum for that, I'm sure there is some thread that can give you a hint on how to do that.
Are we talking a count of the number of letters or count of the number of occurences of whatever word youre looking for?
WebFOCUS: 7702 O/S : Windows Data Migrator: 7702
Posts: 127 | Location: San Antonio | Registered: May 29, 2009
Here is a possible solution. I used Dialogue Manager but with some minor changes this should work in a DEFINE, too. First replace the search string ('car' in this example) with a single character that won't ever appear in your text string (I used the tilde ~ here). Next remove that character from the second string. The difference between the lengths of the second and third strings will give you the number of occurrences of the search string in the original string. The search string 'car' appears four times in the original string.
-SET &TEXT1 = 'this car that car those cars all have "scars"!';
-SET &TEXT2 = STRREP(&TEXT1.LENGTH,&TEXT1,3,'car',1,'~',&TEXT1.LENGTH,'A&TEXT1.LENGTH');
-SET &TEXT3 = STRIP(&TEXT2.LENGTH,&TEXT2,'~','A&TEXT2.LENGTH');
-SET &TEXT2_LEN = ARGLEN(&TEXT2.LENGTH,&TEXT2,'I3');
-SET &TEXT3_LEN = ARGLEN(&TEXT3.LENGTH,&TEXT3,'I3');
-SET &COUNTX = &TEXT2_LEN - &TEXT3_LEN ;
-TYPE &TEXT1
-TYPE &TEXT2
-TYPE &TEXT3
-TYPE &TEXT2_LEN
-TYPE &TEXT3_LEN
-TYPE &COUNTX
If you need to find whole words, then put spaces around the search string (i.e., ' car '):
-SET &TEXT2 = STRREP(&TEXT1.LENGTH,&TEXT1,5,' car ',1,'~',&TEXT1.LENGTH,'A&TEXT1.LENGTH');
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Thanks Waz. We all have our brilliant moments and our "what the Focus was I thinking" moments. But actually I think there was a similar post in the past year. I couldn't find it but I seemed to remembered the basic concept from that post. Cheers.
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Thanks to all!! i will try the solutions. i build one by using the posit function. -SET &SORTBY1=STRIP(60, &Sortfeld2, ' ', 'A60'); -SET &SORTBY=POSIT(&SORTBY1,60,'BY',2, I2); -SET &ROUND1 = IF SORTBY1 GT '0' THEN '1' ELSE '0'; -SET &SORTBY2 = SUBSTR(60, &SORTBY1, &SORTBY + 1, 60, 50, A60); -SET &SORTBY_1=POSIT(&SORTBY2,60,'BY',2, I2); -SET &ROUND2 = IF &SORTBY_1 GT '0' THEN '1' ELSE '0'; -SET &SORTBY3 = SUBSTR(60, &SORTBY2, &SORTBY_1 + 1, 60, 50, A60); -SET &SORTBY_2=POSIT(&SORTBY3,60,'BY',2, I2); -SET &ROUND3 = IF &SORTBY_2 GT '0' THEN '1' ELSE '0'; -SET &SORTBY4 = SUBSTR(60, &SORTBY3, &SORTBY_2 + 1, 60, 50, A60); at the end i counted the &ronds. i think your solutions are much smarter but im just a beginner!!!
greetings
christian
WF Production Version: 7.7.02M WF Test Version: 7.7.02M Developer Studio: 7.7.02 HTML, EXL2K, FLEX, PDF,PPT