Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Columns on Ace Report

Status
Not open for further replies.

dodge20

MIS
Jan 15, 2003
1,048
US
I have a report that is used to print address labels. It currently prints only the left side of the paper. I want to know if it is possible to print multiple columns of addresses rather than just 1.

Here is my code


define
variable userbdate date
variable useredate date
end

input
prompt for userbdate using "Enter beginning date: "
prompt for useredate using "Enter ending date: "
end

output
top margin 0
bottom margin 0
left margin 0
page length 6
end

select *
from tcc_shop
where expir_date >= $userbdate
and expir_date <= $useredate
order by zip
end

format

on every row
print expir_date,2 spaces,mail_rt,2 spaces,&quot;W/S &quot;,ws_no,1 space,ws_ltr
print name
print attn
print address
print city,1 space,state,1 space,zip
skip 2 lines
on last row
skip 10 lines
print &quot;Label count: &quot;, count using &quot;####&quot;
end
 
For those interested, I did figure this out. Here is an example of the code. It didn't paste very well, but you get the idea.


DEFINE
VARIABLE cst char(43) {holds city, state, zip}
VARIABLE country CHAR(15) {variable for country}
VARIABLE array1 char(84) {Array for Rep., Cust ID}
VARIABLE array2 char(84) {Array for contact}
VARIABLE array3 char(84) {Array for company}
VARIABLE array4 char(84) {Array for address line 1}
VARIABLE array5 char(84) {Array for address line 2}
VARIABLE array6 char(84) {Array for city, state, zip}
VARIABLE array7 char(84) {Array for country}
VARIABLE start smallint {start of current label in array}
VARIABLE finish smallint {end of current label in array}
VARIABLE l_size smallint {label width}
VARIABLE white smallint {spaces between each label}
VARIABLE count1 smallint {number of labels across page}
VARIABLE i smallint {label counter}
VARIABLE pg_count smallint {page counter}
VARIABLE bg_date DATE {date criteria}
END

INPUT
PROMPT FOR bg_date USING
&quot;Enter Customer Review Date for search (mm/dd/yyyy)?&quot;
END

OUTPUT
TOP MARGIN 2
BOTTOM MARGIN 0
LEFT MARGIN 0
PAGE LENGTH 60
REPORT TO &quot;/var/tmp/labels.out&quot;
END

SELECT
cust, {customer ID 10A}
arname, {customer name 30A}
aradr1, {address line 1 30A}
aradr2, {address line 2}
arcity, {city 20A}
arstat, {state 10A}
arzip, {zip code 10A}
arctry, {country 15A}
arcont, {customer contact 15A}
arcat, {customer category, to be used for BG code}
arsale, {sales rep. ID 10A}
arnoten, {note code used for source}
arcdat {credit review date, to be used for BG date}
FROM
arcust
WHERE arcdat = $bg_date AND
arcat = &quot;bg&quot;
ORDER BY arzip
END

FORMAT
FIRST PAGE HEADER

{ Nothing is displayed in this control block. It just initializes
variables that are used in the ON EVERY ROW control block }

LET count1 = 2 {# of labels across page, 2 up}
{count1=3 for 3 up}
LET i = 1 {Initialize label counter.}
LET l_size = 80/count1 {Determine label width (allow
five spaces total between labels) }
LET white = 5/count1 {Divide the five spaces between
the number of labels across the page.}
LET pg_count = 1 {Init. no of labels on page}

ON EVERY ROW
IF arctry = &quot;U.S.A.&quot; OR arctry = &quot;USA&quot; THEN
BEGIN
LET country = &quot; &quot;
LET cst = arcity CLIPPED, &quot;, &quot;, arstat CLIPPED, &quot; &quot;,
arzip CLIPPED
END
ELSE
BEGIN
LET country = arctry
LET cst = arcity CLIPPED, &quot; &quot;, arstat CLIPPED, &quot; &quot;,
arzip CLIPPED
END

LET finish = i * (l_size + white)
IF i = 1 THEN {force start for each label}
LET start = 2
ELSE
LET start = 44


{ This section assigns names, companies, addresses and zip codes
to arrays 1 thru 7 until i = the number of labels across a page }

LET array1[start, finish] = arnoten, &quot;*&quot;, arsale
LET array1[finish - 15, finish] = cust
LET array2[start, finish] = arcont {contact}
LET array3[start, finish] = arname {company}

IF aradr1 = &quot; &quot; THEN {move lines up one if 1st}
BEGIN {address line is blank}
LET array4[start, finish] = aradr2
LET array5[start, finish] = cst
LET array6[start, finish] = country
LET array7[start, finish] = &quot; &quot;
END
ELSE
IF aradr2 = &quot; &quot; THEN {move lines up one if 2nd}
BEGIN {address line is blank}
LET array4[start, finish] = aradr1
LET array5[start, finish] = cst
LET array6[start, finish] = country
LET array7[start, finish] = &quot; &quot;
END
ELSE
BEGIN {print all address lines}
LET array4[start, finish] = aradr1
LET array5[start, finish] = aradr2
LET array6[start, finish] = cst
LET array7[start, finish] = country
END

IF i = count1 THEN
BEGIN
PRINT array1 CLIPPED {Print Rep. and Cust ID}
PRINT array2 CLIPPED {Print contact}
PRINT array3 CLIPPED {Print company}
PRINT array4 CLIPPED {Use clipped to remove trailing}
PRINT array5 CLIPPED {spaces for quicker printing.}
PRINT array6 CLIPPED
PRINT array7 CLIPPED
SKIP 1 LINE
LET array1 = &quot; &quot; {Reset the arrays to spaces.}
LET array2 = &quot; &quot;
LET array3 = &quot; &quot;
LET array4 = &quot; &quot;
LET array5 = &quot; &quot;
LET array6 = &quot; &quot;
LET array7 = &quot; &quot;
LET i = 1
LET pg_count = pg_count + 1 {increment # of lables}

IF pg_count > 7 THEN
BEGIN
SKIP TO TOP OF PAGE
LET pg_count = 1
END

END
ELSE
LET i = i + 1

ON LAST ROW
IF i > 1 {Print the last set of addresses}
THEN
BEGIN {if there were any left.}
PRINT array1 CLIPPED
PRINT array2 CLIPPED
PRINT array3 CLIPPED
PRINT array4 CLIPPED
PRINT array5 CLIPPED
PRINT array6 CLIPPED
PRINT array7 CLIPPED

LET pg_count = pg_count + 1
IF pg_count > 7 THEN
BEGIN
SKIP TO TOP OF PAGE
LET pg_count = 1
END

END
END
Dodge20
If it ain't broke, don't fix it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top