Mike,
The following code sets the location to wrap a text string:
{begin Code}
LABEL bgprog
SET VAR v1 TEXT = +
'This is a test to concatenate several lines of text into another '
SET VAR v2 TEXT = +
'variable and write the contents of the resulting variable to provide '
SET VAR v3 TEXT = +
'programmers on the R:BASE list server a code sample to see if they '
SET VAR v4 TEXT = +
'are able to duplicate our problem or if we have some type of
configuration '
SET VAR v5 TEXT = 'issue. '
SET VAR v6 TEXT = +
'This code wraps the variable at position 40. What we are seeing is '
SET VAR v7 TEXT = +
'spaces in position 41 are not truncated but inserted at the beginning of
'
SET VAR v8 TEXT = 'the following line. '
SET VAR vnote NOTE = (.v1 & .v2 & .v3 & .v4 & .v5 & .v6 & .v7 &
.v8)
CLEAR VAR v1,v2,v3,v4,v5,v6,v7,v8
SET VAR vstrtmp NOTE
SET VAR vgetlen INTEGER
SET VAR vgettext TEXT
SET VAR vstrlen INTEGER
--the location for Text To Wrap
SET VAR vwrap INTEGER = 40
SET VAR vcrlf = ((CHAR(13))+(CHAR(10)))
SET VAR vstrlen = (SLEN(.vnote))
WHILE vstrlen > 0 THEN
SET VAR vsloc = .vwrap
--test for location of space at wrap point
IF (SGET(.vnote,1,.vwrap)) <> ' ' THEN
-- loop backwards till find set var vgetlen = .vsloc
WHILE (SGET(.vnote,1,.vsloc)) <> ' ' THEN
IF (SLEN(.vnote)) <= .vsloc THEN
SET VAR vsloc = (SLEN(.vnote))
SET VAR vgetlen = (SLEN(.vnote))
ELSE
SET VAR vsloc = (.vsloc - 1)
SET VAR vgetlen = .vsloc
ENDIF
ENDWHILE
SET VAR vgettext = (SGET(.vnote,.vgetlen,1))
SET VAR vgettext = (LJS(.vgettext,.vgetlen))
SET VAR vgettext = (STRIM(.vgettext))
SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf)
SET VAR vstrlen = (.vstrlen - .vgetlen)
IF vstrlen < 0 THEN
SET VAR vstrlen = (SLEN(.vnote))
ENDIF
SET VAR vnote = (SGET(.vnote,.vstrlen, (.vgetlen + 1)))
ELSE
SET VAR vgettext = (SGET(.vnote,.vwrap,1))
SET VAR vgettext = (LJS(.vgettext,.vwrap))
SET VAR vgettext = (STRIM(.vgettext))
SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf)
SET VAR vstrlen = (.vstrlen - .vwrap)
IF vstrlen < 0 THEN
SET VAR vstrlen = (SLEN(.vnote))
ENDIF
SET VAR vnote = (SGET(.vnote, .vstrlen, (.vwrap + 1)))
ENDIF
ENDWHILE
SET VAR vnote = (SRPL(.vstrtmp,' ', ' ',0))
LABEL ndproc
show var vnote=.vwrap at 5 20
CLEAR VAR vcrlf,vgetlen,vgettext,vsloc,vstrlen,vstrtmp,vwrap
RETURN
{end Code}
----- Original Message -----
From: "Michael J. Sinclair" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, November 24, 2010 12:41 AM
Subject: [RBASE-L] - Simple report problem in Rbase 7.6
Hi All,
I have to make a report. It does not to look too fancy. The app that use
the
report creates a bunch of variables, all text. Each variable can be from 0
charters long to a few hundred characters. Each Variable represents a
paragraph
on the report. Variable v1 is always the first paragraph, v2 is always the
second paragraph etc. some of the variables are equal to null, so I want
to skip
those paragraphs, but not have a big space on my report. Each line in each
paragraph should be no more than 80 characters, and the paragraphs should
support word wrapping in case the length of the variable exceeds 80
characters.
No line should be any longer than 80 characters.
No need for headers, footers. might be nice to have page numbers but even
that
is not critical.
This was easy to do in Rbase for DOS, but now I want to do it in Rbase for
windows, version 7.6.
I need to be able to print the report to file that I can read with
Notepad.
How do I create such a report? Is there a sample that is similar??
Mike