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, I have a field in a database that has a lot of text and I need to place sentences on a new line within a single compute virtual field when prefixed with a >>
I also need to look for words that have a double equals sign before and after the word and place them on their own line. So within one compute virtual field, I need to have this format:
==Prepare Muffins== >>Get the flour >>Get the sugar >>Find some berries ==Bake The Muffins== >>set oven to 350 >>grease a pan >>place muffins in oven >>set timer for 40 min
Right now, the data in the field looks like:
==Prepare Muffins==>>Get the flour>>Get the sugar>>Find some berries==Bake The Muffins==..and so on.
Is this possible with some text functions?
Using App Studio 8204 ThanksThis message has been edited. Last edited by: FP Mod Chuck,
Originally posted by Waz: Whats the output format ?
Agreed. In order to answer this, we need to know what the output will be, since outputs have different answers.
There is probably a better way to do this, but this COMPUTE with nested functions works for HTML
-SET &TEXT = '==Prepare Muffins==>>Get the flour>>Get the sugar>>Find some berries==Bake The Muffins==>>set oven to 350>>grease a pan>>place muffins in oven>>set timer for 40 min';
TABLE FILE CAR
PRINT COMPUTE NEWFIELD/A200V = SUBSTRING(REPLACE(REPLACE(REPLACE(&TEXT.QUOTEDSTRING,'>>','<br>>>'),'==','<br>=='),'<br>==<br>>>','==<br>>>'),5,200);
BY COUNTRY NOPRINT
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE SET PAGE-NUM NOPAGE
END
Hallway
Prod: 8202M1
Test: 8202M4
Repository:
OS:
Outputs:
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015
In JavaScript you can use the replace function using a regular expression. Copy/paste this code into the console of any modern browser (And no, IE is not a modern browser)
var oldText = '==Prepare Muffins==>>Get the flour>>Get the sugar>>Find some berries==Bake The Muffins==>>set oven to 350>>grease a pan>>place muffins in oven>>set timer for 40 min'
var newText = oldText.replace(/(?<=[a-z])={2}(?!>)|>{2}/g, '\n$&')
console.log(newText);
That will return the following to the console:
==Prepare Muffins==
>>Get the flour
>>Get the sugar
>>Find some berries
==Bake The Muffins==
>>set oven to 350
>>grease a pan
>>place muffins in oven
>>set timer for 40 min
Hallway
Prod: 8202M1
Test: 8202M4
Repository:
OS:
Outputs:
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015
Use Hallways first method but use HEXBYT(10,'A1') to insert a linefeed character instead of the the HTML breaks ( <br> ) then use LINEFEED='LF' within the styling.
Sorry, just made a discovery. The carriage returns and line feeds are coming across fine in the SQL field I'm using. For example, when I copy that text from Oracle SQL Developer to Notepad, I can see the format as intended. Is there a way I can tell the field in App Studio to just observe the CRs and LFs that are stored in the text field?
Yes, use the LINEFEED syntax within your styling. You need to have consistant characters in your data or just take a punt and specify just LINEFEED=CR or LINEFEED=LF.
This should be found in the documentation link that I gave.
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
Originally posted by DataCarniv0r: Thanks for the replies. PDF is my output. What is my bet option then?
Thank you!
This works:
-SET &TEXT = '==Prepare Muffins==>>Get the flour>>Get the sugar>>Find some berries==Bake The Muffins==>>set oven to 350>>grease a pan>>place muffins in oven>>set timer for 40 min';
DEFINE FILE CAR
NEWFIELD/A200V WITH COUNTRY = SUBSTRING(REPLACE(REPLACE(REPLACE(&TEXT.QUOTEDSTRING,'>>', CTRLCHAR(CR) | CTRLCHAR(LF) | '>>' ),'==', CTRLCHAR(CR) | CTRLCHAR(LF) | '=='),CTRLCHAR(CR) | CTRLCHAR(LF) |'=='|CTRLCHAR(CR) | CTRLCHAR(LF) |'>>','=='| CTRLCHAR(CR) | CTRLCHAR(LF) |'>>'),3,200);
END
TABLE FILE CAR
SUM NEWFIELD
ON TABLE PCHOLD FORMAT PDF
-* ON TABLE NOTOTAL
-* ON TABLE SET DROPBLNKLINE ALL
-* ON TABLE SET PAGE-NUM NOPAGE
-* ON TABLE SET CACHELINES 100
-* ON TABLE SET GRWIDTH 1
-* ON TABLE SET AUTOFIT OFF
ON TABLE SET STYLE *
TYPE=REPORT,LINEBREAK='CRLF',$
ENDSTYLE
END
Originally posted by Tony A: Yes, use the LINEFEED syntax within your styling. You need to have consistant characters in your data or just take a punt and specify just LINEFEED=CR or LINEFEED=LF.
This should be found in the documentation link that I gave.
T
or if there is a CR and a LF, try:
TYPE=REPORT,LINEBREAK='CRLF',$
Syntax: How to Display An and AnV Fields Containing Line Breaks on Multiple Lines
TYPE=REPORT,LINEBREAK='type',$
where:
REPORT
Is the type of report component. TYPE must be REPORT. Otherwise an error will result.
'type'
Specifies that line breaks will be inserted in a report based on the following:
LF inserts a line break after each line-feed character found in all An and AnV fields.
CR inserts a line break after each carriage-return character found in all An and AnV fields.
LFCR inserts a line break after each combination of a line-feed character followed by a carriage-return character found in all An and AnV fields.
CRLF inserts a line break after each combination of a carriage-return character followed by a line-feed character found in all An and AnV fields.
Thank you both very much. It works like a champ, but now I have a new problem.
This works: I created a computed column using: CTRAN(1000, MY_SQL_FIELD, 094, 013, Funding)
Then I added this to my source within the style section as per the docs: TYPE=REPORT,LINEBREAK='CR',$
When I run it, it looks exactly as expected. I saved it. But when I switch to the Design tab, and then back to the Source tab, the TYPE=REPORT,LINEBREAK='CR',$ line I put in there is gone!
Is this a known issue or is there any workaround I can do?
When I run it, it looks exactly as expected. I saved it. But when I switch to the Design tab, and then back to the Source tab, the TYPE=REPORT,LINEBREAK='CR',$ line I put in there is gone!
Is this a known issue or is there any workaround I can do?
Thanks
There are a lot if issues with AppStudio reformatting/replacing code in the GUI. It get frustrating at times when the GUI doesn't even recognize valid FOCUS code like you are experiencing. If I ever use the GUI it is just to get the basic report laid out. I then open the report in VSCode (or any other text editor you may prefer) and edit the code in that if I need to do any tweaks.
Good luck.This message has been edited. Last edited by: Hallway,
Hallway
Prod: 8202M1
Test: 8202M4
Repository:
OS:
Outputs:
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015