JM,
The Following Code was written as a workaround to a show variable command
a couple of versions back. You could use the structure of this to create a
stored procedure that would return your concantenated text as well as the
number of lines by counting the loops in the While Loop that makes up the
Note Variable. I can see no reason this won't work for you......
*( 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 wrap location
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: "J.M. GRATIAS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 4:21 AM
Subject: Re : A PAGMODE question
>
> Dennis McGrath :
>
> >>
> Why not do two-pass process for each product? You can calculate how much
> room you need for the product first. If it will fit, do the output,
> otherwise start new page and do the output.
> <<
>
> I discarded this solutions for 2 reasons :
>
> 1) My solution is must more rapid because the current product is writen at
> the rigth place and I have to undo it in a few cases (10 % if one page
> contains about 10 products),
>
> 2) To calculate how much room I need for the product, I must write it
> somewhere (SHOW VAR Variablename=40 AT .vline, .vcolumn + SET var vcursor
=
> (ISTAT('PAGEROW'))) and I don't think PAGEMODE will allow to change output
> without clearing the current page.
>
>
> MikeB :
>
> >>
> Can't you accumulate the lines for the description into one variable
> (instead of commiting to the virtual page each line) with CrLf at the end
> of each line,
> <<
>
> I could probably do that, but it would be longer, take more code and be
> more difficult to test and to maintain.
> As I am in PAGEMODE, I use a DECLARE cursor WHILE LOOP...
>
> Thanks for your help ....
>
> J.M. GRATIAS, Logimatique
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: INTRO rbase-l
> ================================================
> TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: UNSUBSCRIBE rbase-l
> ================================================
> TO SEARCH ARCHIVES:
> http://www.mail-archive.com/rbase-l%40sonetmail.com/
>
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/