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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Search and Replace
 Login/Join
 
Gold member
posted
Has anybody been able to code a generic-search-and-replace function ?

-*
-* Replace occurances of P2 in P1 with P3
-*
DEFINE FUNCTION SREPLACE/A255(P1 A255, P2 A255, P3 A255)
...
...
END

I was about to implement it but fell short of how finding out syntax to
write a loop in webfocus. I dont see in manuals how to write a loop. Any
ideas ? I see that the DM kind of GOTO is not supported in functions.


WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
 
Posts: 85 | Registered: December 20, 2005Report This Post
Platinum Member
posted Hide Post
Working on WebFOCUS 7, we can use STRREP function:

STRREP Function: Replacing Character Strings
(documented as 7.1.3 new feature)

Simple D.M. Example tested with WF 7.1.0 & 7.1.1:
-SET &V1 = 'a OR b OR c OR d OR e' ;
-SET &V2 = STRREP(&V1.LENGTH, &V1, 4, ' OR ', 1, ',', &V1.LENGTH, 'A&V1.LENGTH');
-TYPE V1= &V1
-TYPE V2= &V2

Output:
V1= a OR b OR c OR d OR e 
V2= a,b,c,d,e

Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
Platinum Member
posted Hide Post
STRREP Function: Replacing Character Strings
Documented as 7.1.3 new feature but working with 7.1.0 and 7.1.1 (?)

Syntax: How to Replace Character Strings

STRREP (inlength, instring, searchlength, searchstring, replength, repstring, outlength, outstring)

Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
Gold member
posted Hide Post
I see. I am on 5.3.3.

I guess I will try javascript. Thx.


WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
 
Posts: 85 | Registered: December 20, 2005Report This Post
Gold member
posted Hide Post
I tested it just now on 5.3.3 and yes it worked. Thx for the tip. That helped me avoid a whole bunch of coding.


WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
 
Posts: 85 | Registered: December 20, 2005Report This Post
<Antony Gubert>
posted
Hi,

I think that the above function work only when you know the length of each value of the string. What is the solution if I get a string as input and want to apply find and replace method. Please let me know.

Thanks
 
Report This Post
Gold member
posted Hide Post
How about using LENGTH function to first find lengths ?

-SET &V1 = 'ABCDEFGH';
-SET &L1 = &V1.LENGTH;

This message has been edited. Last edited by: Govind Jujare,


WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
 
Posts: 85 | Registered: December 20, 2005Report This Post
<JG>
posted
What's actually interseting about the example is that the output is wrong.

When you use FTOA it left justifies the text it creates.

Also the substitution is invalid because all of the columns are not
the same number of characters, so you end up with
 
      USD 123456
      USD 12345  


If it was correctly justified it would look like

 
      USD 123456
       USD 12345  



A floating $ is wrong, the example would only work if the format of the field
is Dt.sN
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders