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.
Does anyone have a little routine that performs and search and replace on a string? I have a string that looks something like this: 'a OR b OR c OR d OR e' and I want to replace the OR with a comma... I tried to write my own search and replace but am having problems with substr padding my strings and I couldn't remove the padding...
Thanks!
-Daniel.,This message has been edited. Last edited by: <Kathryn Henning>,
Here is the code, I did in both ways. using dialogue manager and using Define.
-SET &TESTVAR='A OR B OR C OR D'; -SET &DECVAL=BYTVAL('O','I3'); -SET &DECVAL1=BYTVAL('R','I3'); -SET &CHGTVAR=CTRAN(50,&TESTVAR,&DECVAL,44,'A50'); -SET &CHGTVAR1=CTRAN(50,&CHGTVAR,&DECVAL1,32,'A50');
DEFINE FILE CAR TESTVAR/A50='A OR B OR C OR D'; DECVAL/I3=BYTVAL('O','I3'); DECVAL1/I3=BYTVAL('R','I3'); -*CTRAN(charlen, string, decimal, decvalue, outfield) CHGTVAR/A50=CTRAN(50,TESTVAR,DECVAL,44,CHGTVAR); CHGTVAR1/A50=CTRAN(50,CHGTVAR,DECVAL1,32,CHGTVAR1); END
TABLE FILE CAR HEADING " <TESTVAR " " <CHGTVAR1 " " TESTVAR AMP : &TESTVAR " " CHGVAR AMP : &CHGTVAR1 " PRINT * WHERE RECORDLIMIT EQ 10 END -EXIT
I'm not sure whether we have a function to do this. We may have it.
WFConsultant
WF 8105M on Win7/Tomcat
Posts: 780 | Location: Florida | Registered: January 09, 2005
Do you have a more generic version of the code that will not replace Os and Rs with commas and spaces as my terms may contain those letters? I want something like replace ' OR ' with ', '
Hey thanks , susannah , i'v never came across that function before
Cool !!
P.
D: WF 7.6.2 P. : WF 7.6.2 on W2003 ------------------------------------------------------------------ I see myself as an intelligent, sensitive human, with the soul of a clown which forces me to blow it at the most important moments.
Has anybody done the code for 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 I could not find the syntax for REPEAT/GOTO anywhere. Any idea ?
BTW, my requirement is exactly same as the requirement in this thread. I am trying to convert the webfocus's javascript generated code of following kind -
WHERE V1 EQ 'A' OR 'B' OR 'C';
into -
WHERE V1 IN ('A','B','C');
so that I can plug it directly into DB2 SQL.This message has been edited. Last edited by: Govind Jujare,
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
Just for info, and with the usual overrides, this also works in 5.3.2 on Windows. Just be careful that as it is quoted as a new feature as of 7, that this may not be supported in earlier versions even though it appears to function.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Does your data contain OR values? In the example above, that is the value being replaced. Please see the documentation link in Mikel's comments above. The fourth parameter is the character string to be replaced.