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.
So there is a very standard, very useful string function named stran that goes through string_orig and replaces all instances of string1 with string2
stran(string_orig, string1, string2)...
This function is only available in Maintain. I want to know
a) is there a comparable function in reporting
b) if not, then why not.
Does anyone have any ideas?
Functions that are NOT going to work for me are OVERLAY - with overlay the programmer needs to supply the location of every string they want to alter CTRAN - with ctran it will only replace one character for another single character.
Why are there functions that are available in maintain but not in focus reporting?
Posts: 77 | Location: Chicago, IL | Registered: May 06, 2004
I was able to use a replace in a sql passthrough but it seems like a big workaround to do such a simple task. This is one of the first things you are taught in almost any programming language, string manipulation. I would think that it would be a little more intuitive/possible in focus.
Any other suggestions on how to do this in native focus?
Posts: 77 | Location: Chicago, IL | Registered: May 06, 2004
FYI, WebFOCUS Allows you to create and use your own User Written Subroutines. In windows this would be a dll and unix a .so and in MVS a compile program. I have create on a long time ago for a state agency that need to know who may letters and numbers were in a string like how many 9's how many A' etc. This was so they could order the colored coded folder labels like doctor offices use. Has any one out there created there own subroutines? and if so what do they do? May IBI need to have a site or forum that will allow users to share there subroutines?
Maybe this will work for you. There are two strategies here. If the 2 strings are the same length then you can use the OVRLAY subroutine in conjunction with the POSIT subroutine. The second method is to split the string up into 3 parts, using SUBSTR and POSIT and concatenate the new string inbetween the two other strings.
The following code replaces the character string AN with XXX in the COUNTRY field of the CAR database.
I hope this helps.
DEFINE FILE CAR -*IF THE 2 STRINGS ARE DIFFERENT LENGTHS THEN USE THIS CODE. START_POS /I2 = POSIT(COUNTRY, 10, 'AN', 2, 'I2'); FINSH_POS /I2 = IF START_POS EQ 0 THEN 0 ELSE START_POS + 2; BEGIN_STR /A10 = SUBSTR (10,COUNTRY,1,(START_POS-1),10,'A10'); END_STR /A10 = SUBSTR (10,COUNTRY,FINSH_POS, 10,10,'A10'); NEW_LNGSTR /A23 = IF START_POS EQ 0 THEN COUNTRY ELSE BEGIN_STR || 'XXX' || END_STR; NEW_STR /A11 = SUBSTR (23, NEW_LNGSTR, 1,11,11,'A11'); -*IF THE 2 STRINGS ARE THE SAME LENGTH THEN USE THIS CODE. POS /I2 = POSIT(COUNTRY, 10, 'AN', 2, 'I2'); OVRL /A10 = OVRLAY(COUNTRY, 10, 'XX', 2, POS, 'A10'); END TABLE FILE CAR PRINT COUNTRY POS OVRL START_POS FINSH_POS BEGIN_STR END_STR NEW_LNGSTR NEW_STR END
Posts: 1 | Location: Detroit | Registered: February 14, 2005
I appreciate the help but again the code provided here only helps for a single occurance. I'm lookinging to replace '|' with ' ' in a field that has many instances of the verticle pipe.
It just seems silly to have to jump through so many hoops when in any other language it would be something like
For anyone who needs it, I used the following code using an sql passthrough...
SQL SQLORA SET SERVER MYSERVERNAME SQL SQLORA select REPLACE(field_name, '|', ' ') from table_name where date = '2004/02/07'; ENDThis message has been edited. Last edited by: <Mabel>,
Posts: 77 | Location: Chicago, IL | Registered: May 06, 2004