======================================================================
COMPRESS BLANK LINES OUT OF FORM LETTER HEADERS
======================================================================
PRODUCT : R:BASE, PRB VERSION : 2.11,3.1 or Higher
CATEGORY : REPORTS SUBCATEGORY : BLANK LINES
======================================================================
From Joe Howard, Microrim Technical Support Specialist
R:BASE 3.x made printing labels easy with its built-in ability to
compress out blank lines. Nevertheless, as a technical support veteran
I am repeatedly asked how to do the exact same thing for the header
information in a form letter.
Past issues of the R:BASE EXCHANGE have discussed a technique for
compressing out blank lines in a report that prints 4-across labels, but
these articles did not mention form letters in particular. The concept is
the same, but the routine has been changed to work with form letters.
To begin, you must determine what data you want to display in the header.
To illustrate, let's use a fictitious database with a table called client.
These are the pertinent columns in client:
Colname Type Size
-------- ------- ----
clnumber INTEGER
clname TEXT 25
company TEXT 40
address1 TEXT 35
address2 TEXT 35
city TEXT 20
state TEXT 2
zipcode TEXT 10
After you have identified the columns that will appear in the header
section of the form letter, identify the length of the longest item.
In this example, company is a TEXT column of length 40. We also know
that the header will contain six lines. On the basis of that information,
we will build a long, 240-character (6 * 40) text variable with the
client's name in the first 40 characters, the company name in the second
40 characters, and so on. When we locate this variable on the report, we
will wrap it at 40 characters and mark it down six lines.
What causes the compression of blank lines? In the process of putting
these values into the long text string we use a function called Left
Justify (LJS). This function compresses out null values.
That's the concept behind this process. Now let's put it to work.
In designing the report that will print your form letter, you will
probably want to print one client per page. To do this you will need
to establish a break point on the column named clnumber (client number,
a unique identification for each client). On the Reports menu under
Layout, choose the Create Breakpoints option. Also add a form feed
after the break.
The expressions (or variables) are vital in this process. Following
are the expressions used in this example:
vcsz text = (city + ',' & state & zipcode)
vline1 text = ((ljs(clname,40))+company)
vline2 text = ((ljs(.vline1,80))+address1)
vline3 text = ((ljs(.vline2,120))+address2)
vline4 text = ((ljs(.vline3,160))+.vcsz)
vline5 text = ((ljs(.vline4,200))+(ctxt(clnumber)))
The first line in the expression list combines the city, state, and ZIP
code. The following lines use the LJS function to build the long variable
vline5 . The second parameter in the LJS function increases by 40 each
time. This is because our largest field is 40 characters wide and as we
build the long variable, the size increases by 40. The last expression
uses the CTXT function to convert the integer value, clnumber, into a
text value so that it can be concatenated to the variable.
The variable vline5 is the variable that contains the final results and
is located on the report. Because we have a breakpoint, we want the
information to be printed on either break header lines (H1...H10) or
break footer lines (F1...F10). To locate the variable, place the cursor
on the line you want to start the header information and press F6.
Then enter vline5 into the dialog box that requests the column or
variable name to locate.
Now press S to start the location, then move over exactly 40 characters
by using the right arrow key. Press W to denote a wrapping text field,
then move down six lines by using the down arrow key. Press T to stop
(or truncate) the field at this point, and press Escape when prompted
to press I for indentation. In effect, you are creating a box that has
a width of 40 and a height of 6.