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.
I have a sql database with some large "memo" fields. In these fields people put some text (with an access fronttool) that gets a nice looking make-up like
This is my message
-1) I want this
-2) and this
-3) and this
and here is an other line
but when I build a report on these data (the field has A4000V) I get in the report all the lines concatenated without line breaks.
Any suggestion on how to get this better?
Frank
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
I had a situation that required similar processing in reverse. An Oracle text field contained line feeds and we needed to replace them with spaces to ensure continuous text. What I did was to declare a two byte variable using HEXBYT and then use STRREP to replace the two bytes with a single space. You might be able to use the two byte variable within POSIT or GETTOK to a similar effect?
Frank, We had the same problem here. What happens is that WebFocus doesn't like (yet, I have been led to understand) CrLf's and deletes them. For our customer we built a function which inserts spaces so as to create the new line artificially.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
in one application I build for our own department I cab handle this by inserting a strange character combination into to text where I want the linefeeds to appear "**" p.e. But most of the other application will not work that way.
I have to escalate this to IBI to get this solved the way it should.
Frank
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
What we discovered yesterday that the STRREP function does not work with our installation, so we have to upgrade to 7.1.4. The second thing we discovered is that the text make up we do at the input through Access frontapplication is neglected by HTML and PDF but not when it is presented in Excel even if we use WF to build the report.
So because we have to use both excel as pdf as output I have to find a total other solution. Excel is as it should be, but PDF is not.
Frank
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
Think I have this sorted now. See if this makes sense to you.
The issue: Users enter text (in a multi-line edit or in an another application) and they add some light formatting, e.g.:
Elegy written in a Country Churchyard
_____________________________________
The curfew tolls the knell of parting day,
The lowing herd winds slowly o'er the lea,
The ploughman homeward plods his weary way,
And leaves the world to darkness and to me.
Now fades the glimmering landscape on the sight,
And all the air a solemn stillness holds,
Save where the beetle wheels his droning flight,
And drowsy tinklings lull the distant folds;
By Thomas Gray (1716-71).
The result being saved in an alpha field. When a report is run from this field, in PDF and HTML you may get:
Elegy written in a Country Churchyard___________
__________________________ The curfew tolls the
knell of parting day, The lowing herd winds
slowly o'er the lea, The ploughman homeward plods
his weary way, And leaves the world to darkness
and to me.Now fades the glimmering landscape on
the sight, And all the air a solemn stillness
holds, Save where the beetle wheels his droning
flight, And drowsy tinklings lull the distant
folds;By Thomas Gray (1716-71).
or all on one line, depending on the style sheet. It misses a little something.
To retain formatting in PDF and HTML requires 2 different approaches as they are 2 very different viewers.
For HTML WebFOCUS has kept the formatting, it's just that HTML chooses to ignore it, so the format has to be changed to be HTML friendly.
PDF has to be forced a little to retain the format exactly, but can be nearly there with only two style sheet commands. Then it has to be kicked a bit to get the spacing at the start of the line.
The 'nearly', in PDF, would be:
Elegy written in a Country Churchyard
_____________________________________
The curfew tolls the knell of parting day,
The lowing herd winds slowly o'er the lea,
The ploughman homeward plods his weary way,
And leaves the world to darkness and to me.
Now fades the glimmering landscape on the sight,
And all the air a solemn stillness holds,
Save where the beetle wheels his droning flight,
And drowsy tinklings lull the distant folds;
By Thomas Gray (1716-71).
And it is very close, but misses out on the spacing at the beginning of some lines.
The following code will retain the simple formatting the user entered. The text field in the file is myText, I've tested from a FOCUS datafile (A2000) and from an Access database (A255V):
-DEFAULTS &OUTPUT ='PDF'
SET PAGE = NOPAGE
DEFINE FILE fileName
-* Not as bad as it looks, without comments there is only 11 lines of code.
-* Get the length of the field with ARGLEN within CTRAN, and use CTRAN to change the
-* Line Feed (ascii 10) to a # (ascii 35). You can use any character if you want to.
-* ARGLEN is required, it stops rubbish coming through later.
lf#Text/A4000V = CTRAN(ARGLEN(4000, myText,'I4'), myText, 10, 35, lf#Text);
-* 2 different approaches for HTML and PDF.
-IF &OUTPUT EQ PDF GOTO :PDFCHANGE;
-:HTMLCHANGE
-* For HTML output
-* change the # (which was a line feed originally) to a <BR> to give an HTML line break
br_Text/A4000V = STRREP (4000,lf#Text,1,'#',4,'<BR>',4000,br_Text);
-* Get length with LENV of TRIMV of the string, within STRREP,
-* and change a space to a (an HTML space) to go back to original formatting.
-* This can be ignored if you only want line feeds and no spacing at the start of the line.
sp_Text/A4000V = STRREP(LENV(TRIMV('T', br_Text, 4000, ' ', 1,'A4000V'),'I4'),br_Text,1,' ',6,'&|nbsp;',4000,sp_Text);
-GOTO :CHANGED
-:PDFCHANGE
-* For PDF layout
-* This can be ignored if you only want line feeds and no spacing at the start of the line.
-* Hard to explain! Change the # (which was a line feed originally) to a '#%',(hash percent)
lf%Text/A4000V = STRREP (4000,lf#Text,1,'#',2,'#%',4000,lf%Text);
-* Then CTRAN the # (ascii 35) back to a line feed (ascii 10)
-* (I know it sounds daft but persevere here)
lf_Text/A4000V = CTRAN(4000, lf%Text, 35, 10, lf_Text);
-* Then CTRAN the % (ascii 37) to a null (ascii 0)
-* Why? Anything (except a space) after the line feed seems to kick PDF into action!
-* and add a space at the beginning to get alignment back correctly,
-* other lines have an extra space because of the null character after the line feed.
sp_Text/A4000V = ' ' | CTRAN(4000, lf_Text, 37, 0, sp_Text);
-:CHANGED
END
-* To be honest it is easier to have the formatted text in a subhead/subfoot/heading/footing.
-* In a column it doesn't seem to columnise(?) so well, PDF particularly, with other fields.
-* This example has the formatted text in a column, in a heading and in a subhead.
-* If you don't want line spacing at the start of a line use br_Text (html)
-* or myText (pdf) instead of sp_Text.
TABLE FILE fileName
HEADING
"<sp_Text "
" "
PRINT sp_Text AS ''
BY MYKEY NOPRINT SUBHEAD
"<sp_Text"
" "
ON TABLE PCHOLD FORMAT &OUTPUT
ON TABLE SET STYLE *
UNITS=IN,PAGESIZE=LETTER,ORIENTATION=PORTRAIT,SIZE=8,FONT='COURIER',GRID=OFF,SQUEEZE=ON,$
-* Here is the key to it all for PDF, not really for HTML, but does no harm.
-* See page 29-32 of the creating reports, 713 manual for full syntax.
TYPE=REPORT,LINEBREAK='LF',WRAP=6,$
-* Plus any other styling you want.
ENDSTYLE
END
In HTML & PDF, the output, using the same font as the input, is the same. Other fonts come very close.
Your users may not be as poetic as Thomas Gray, but they can at least have nicer formatted text in their reports.
For pre 7.1 users, this would require the use of a DM loop with POSIT and OVRLAY instead of STRREP. Too much like hard work!
Alan. WF 7.705/8.007
Posts: 1451 | Location: Portugal | Registered: February 07, 2007
This looks very helpful to me, but I have to wait till the upgrade is installed since the function STRREP is not available for me now. But as far as I can see in this FEX and the comment this comes very close to what we need, and I hope I can inspire my colleagues to some poetry too. I will let you know what the result was.
Frank
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006
We are using WF 7.1.3 and the STRREP function is working properly for us. We are on Windows 2000 Server, IIS, ISAPI mode. This function was added in WF 7.1.3. Are you running in Servlet mode? Does IBI have any suggestions as to why it is not working in your install?
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003