Skipping blank address lines when printing

Chris Kelleher

Administrator
Staff member
Hello all!

The following code snippet does not work. The intent is to skip each
address line that is null. Suggestions on how to do this are appreciated or
where to look.

TIA

James E. Dupree
PEG # 1999041502

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
DISPLAY
"Warehouse:" at 14 whse.whse skip
whse.name at 25 skip
whse.addr[1] at 25 when whse.addr[1] > ""
whse.addr[2] at 25 when whse.addr[2] > ""
whse.addr[3] at 25 when whse.addr[3] > ""
whse.addr[4] at 25 when whse.addr[4] > ""
whse.city at 25 space(5) whse.state space(5) whse.zip skip

WITH STREAM-IO NO-LABELS PAGE-TOP WIDTH 132 NO-BOX FRAME F-132f.
[/code]
 

Chris Kelleher

Administrator
Staff member
i print address info by making temp vars and if blank moving the line up -

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
repeat :
if x-addr[x] <> ""
and x-addr[x - 1] = ""
then
assign
x-addr[x - 1] = x-addr[x]
x-addr[x] = ""
.
x = x - 1.
if x = 1
then assign
recheck = recheck + 1
x = 5.
if recheck > 2
then
leave.
end. /*repeat*/
[/code]

darrin
 

Chris Kelleher

Administrator
Staff member
James,

Progress sets up the frame for the display statement at compile time
so it is not possible to leave out a line like this at run time.

The simplest approach would be to build a temp table of the records
and to display that.

Hope this helps,

Zane Appel
Hand Made Software
Progress and Syteline programming services www.HandMadeSoftware.com/Consulting.htm
 

Chris Kelleher

Administrator
Staff member
Symix has an include file that handles this. The program is lib/addr-set.i .
You need to pass it the variable you want to use, and where to find the
files; look at the syntax section and it will explain all.
HTH
Marty Sosso
 

Chris Kelleher

Administrator
Staff member
Like this perhaps

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
define variable t-whseaddr like whse.addr.
define variable t-lcv as integer no-undo.

do t-lcv = 1 to 4 with stream-io no-labels width 132:
if whse.addr[t-lcv] <> '' then
display
whse.addr[t-lcv] @ t-whseaddr.
end.
[/code]
 

Chris Kelleher

Administrator
Staff member
Here's another (old) code snippet that works.

The reason your example doesn't work is based up some progress fundamentals
of how frames work. When you use the display statement, progress first
determines what the frame should look like. The frame is designed with all
four address lines since that is what your display statement has in it. The
"Conditional Display" is working, in that the the whse.addr[] is not
displaying when it is blank; but your problem is that the frame is already
created with 4 lines for the address.

Another way to get good sample code of a mailing label is to use Results to
generate the code (label) then just modify the code it creates. Results
will create something similar to the code below:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>

line-1 = custaddr.name.
line-2 = custaddr.addr[1].
IF addr[2] = "" THEN DO:
line-3 = (STRING(city + ", " + custaddr.state,"!(30)") + zip).
line-4 = "".
line-5 = ("ATTN: " + contact[1]).
line-6 = "".
line-7 = "".
END.
ELSE IF addr[3] = "" THEN DO:
line-3 = addr[2].
line-4 = (STRING(city + ", " + custaddr.state,"!(30)") + zip).
line-5 = "".
line-6 = ("ATTN: " + contact[1]).
line-7 = "".
END.
ELSE IF addr[4] = "" THEN DO:
line-3 = addr[2].
line-4 = addr[3].
line-5 = (STRING(city + ", " + custaddr.state,"!(30)") + zip).
line-6 = "".
line-7 = ("ATTN: " + contact[1]).
END.
line-8 = "".

display line-1
line-2
line-3
line-4

[/code]
 
Top