I think doing this stuff within the variable declaration of the report is
clumsy. I have used a stored procedure for this addressing business for
several years. I have only had to make a second version of the SP for
special action that I didn't anticipate in the first one.
Then you only need to set your var for your address by calling the SP. In
this case like this:
set var vAddr = (call sp_Addr('miby'))
Where the var vAddr is populated with the values from the view created for
the contacts where the CID value = 'miby' resulting in:
MICHAEL E. BYERLEY
902 EAST GUMP ROAD
FORT WAYNE IN 46845-9003
The SP code:
{begin code}
*(sp_Addr mod 011505 mbyerley)
*(Use only 2 Ret VarNames vRetText and vRetInt)
*(Input Params should be of: pt1,pt2, for text pi1,pi2 for Int)
CLEAR VAR MICRORIM_RETURN, stp_return
SET VAR pt1 TEXT
SET VAR vcr = ((CHAR(13)) + (CHAR(10)))
SELECT mainname, address1, address2, city, statename, zipcode, zipplus +
INTO vspmainname IND vspin0, vrettextess1 IND vspin0, vrettextess2 IND
vspin0, +
vspcity IND vspin0, vspstatename IND vspin0,vspzipcode IND vspin0, +
vspzipplus IND vspin0 +
FROM vwcontacts WHERE (cid = .pt1)
IF SQLCODE = 0 THEN
SET VAR vrettext = .vspmainname
IF vrettextess1 <> NULL OR (SLEN((STRIM(.vrettextess1)))) > 0 THEN
SET VAR vrettext = (.vrettext + .vcr + .vrettextess1)
ENDIF
IF vrettextess2 <> NULL OR (SLEN((STRIM(.vrettextess2)))) > 0 THEN
SET VAR vrettext = (.vrettext + .vcr + .vrettextess2)
ENDIF
IF vspcity <> NULL OR (SLEN((STRIM(.vspcity)))) > 0 THEN
SET VAR vrettext = (.vrettext + .vcr + .vspcity)
ENDIF
IF vspstatename <> NULL OR (SLEN((STRIM(.vspstatename)))) > 0 THEN
SET VAR vrettext = (.vrettext + ' ' + .vspstatename)
ENDIF
IF vspzipcode <> NULL OR (SLEN((STRIM(.vspzipcode)))) > 0 THEN
SET VAR vrettext = (.vrettext + ' ' + .vspzipcode)
ENDIF
IF vspzipplus <> NULL OR (SLEN((STRIM(.vspzipplus)))) > 0 THEN
SET VAR vrettext = (.vrettext + '-' + .vspzipplus)
ENDIF
ELSE
SET VAR vrettext = 'No Address Entry'
ENDIF
Clear Var pt1
CLEAR VAR vspin0,vspcity,vspstatename,vrettextess1,vrettextess2, +
vspmainname,vspzipcode,vspzipplus
RETURN .vrettext
{end code}
----- Original Message -----
From: "Alastair Burr" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, April 29, 2009 2:08 PM
Subject: [RBASE-L] - Re: Eliminating Print of Blank Lines in Reports
Ed,
Maybe I've got the wrong end of the stick but if you have blank spaces that
you don't want then do you not need to eliminate a CR/LF?
If so, try setting up your last variable in this way:
vaddress = (.vPrintLine2 + (IFNULL(.vPrintLine2, ' ', (CHAR(013)) )) +
.vPrintLine3 ... )
Regards,
Alastair.
----- Original Message -----
From: Emmitt Dove
To: RBASE-L Mailing List
Sent: Wednesday, April 29, 2009 6:26 PM
Subject: [RBASE-L] - Re: Eliminating Print of Blank Lines in Reports
Ed,
I presented an incomplete thought. What I was really trying to suggest is
that you add ALL of the returns in the individual strings when appropriate,
rather than when you assemble each of the lines into the one final result.
Emmitt Dove
Manager, Converting Applications Development
Evergreen Packaging, Inc.
[email protected]
(203) 214-5683 m
(203) 643-8022 o
(203) 643-8086 f
[email protected]
From: [email protected] [mailto:[email protected]] On Behalf Of Ed Rivkin
Sent: Wednesday, April 29, 2009 12:02 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Eliminating Print of Blank Lines in Reports
Emmitt,
Thanks. I tried the suggested syntax below and it places the carriage
return before printing the .csz
variable so it now prints one line too low.
If I use this syntax for Line 18:
TEXT : PH : vprintline4 = (Ifexists(.name2,.csz+(CHAR(13)),' '))
I still have the previously reported result; i.e. I don't get a space
between print line four and the next
print line. I also tried defining a new variable, .csz2 which includes
.csz+(CHAR(13)) and making
that the 2nd argument in vprintline4. Finally I varied between (CHAR(13))
and (CHAR(013)) without
any change in the result.
Thanks to Javier as well for the band suggestion. Dynamic Height is
highlighted for the Page Header Band.
Sorry to be giving everyone such a challenge but I am really stumped on
this one....
Ed
Apr 29, 2009 10:16:59 AM, [email protected] wrote:
Ed,
Move the (CHAR(13)) to the definition of the print line. What is
happening is that even if your line is blank you’re getting a carriage
return inserted.
18 : TEXT : PH : vprintline4 = (Ifexists(.name2,(CHAR(13))+.csz,'
'))
Emmitt Dove
Manager, Converting Applications Development
Evergreen Packaging, Inc.
[email protected]
(203) 214-5683 m
(203) 643-8022 o
(203) 643-8086 f
[email protected]
From: [email protected] [mailto:[email protected]] On Behalf Of Ed Rivkin
Sent: Wednesday, April 29, 2009 11:00 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Eliminating Print of Blank Lines in Reports
Razzak,
Thanks for the quick response last night. Here's what I did. Unfortunately
I still have the same spacing problem.
My first print line always prints so I didn't include it in the
IFEXISTS/IFNULL logic
or the vaddress variable.
Here are my variables.
1 : TEXT : PH : sal = salutation in salutation where salut = salut
2 : TEXT : PH : fname = fnamer in tenant where acct = acct
3 : TEXT : PH : lname = lnamer in tenant where acct = acct
4 : TEXT : PH : v1name = (sal & fname & lname)
5 : TEXT : PH : sal2 = salutation in salutation where salut2 = salut2
6 : TEXT : PH : fname2 = fnamer2 in tenant where acct = acct and
salut ne '5'
7 : TEXT : PH : lname2 = lnamer2 in tenant where acct = acct and
salut ne '5'
8 : TEXT : PH : name2 = (sal2 & fname2 & lname2)
9 : INTEGER : PH : addr = addr1r in tenant where acct = acct
10 : TEXT : PH : st = street in commaddr where stcode = stcode
11 : TEXT : PH : street = (ctxt(.addr) & st)
12 : TEXT : PH : city = city in commaddr where stcode = stcode
13 : TEXT : PH : state = state in commaddr where stcode = stcode
14 : TEXT : PH : zipcd = zipcd in commaddr where stcode = stcode
15 : TEXT : PH : csz = (.city + ',' & state & zipcd)
16 : TEXT : PH : vprintline2 = (IFEXISTS(.name2,.name2,.street))
17 : TEXT : PH : vprintline3 = (Ifexists(.name2,.street,.csz))
18 : TEXT : PH : vprintline4 = (Ifexists(.name2,.csz,' '))
19 : NOTE : PH : vaddress =
(.vPrintLine2+(CHAR(013))+.vPrintLine3+(CHAR(013))+.vPrintLine4+(CHAR(013)))
.vaddress is in the report as a Variable Memo with "stretch" clicked on.
When lines 2,3,4 print, everything lines up perfectly. When line 4 prints
as blank,
I still have the extra line. This is printing in the break header which is
where I want it.
Thanks again,
Ed
Apr 28, 2009 09:32:15 PM, [email protected] wrote:
At 10:05 PM 4/28/2009, Ed Rivkin wrote:
>how does one eliminate the now additional blank lines and
>get the spacing between addresses consistent regardless of
>the number of lines that printed.
Ed,
The best option is to use "Variable Memo" control based on
the expression that handles the blank data.
Once you place the Variable Memo and associate the control
with appropriate variable, you may adjust the height to a
minimum and make sure to allow "stretch".
Example:
vCityStateZip = (City + ','&State&ZipCode)
vPrintLine1 = (FirstName&LastName)
vPrintLine2 = (IFEXISTS(Company,Company,AddressLine1))
vPrintLine3 = (IFEXISTS(Company,AddressLine1,(IFNULL(Company, +
(IFEXISTS(AddressLine2,AddressLine2,.vCityStateZip)),.vCityStateZip))))
vPrintLine4 =
(IFEXISTS(Company,(IFEXISTS(AddressLine2,AddressLine2,.vCityStateZip)), +
(IFNULL(Company,(IFNULL(AddressLine2,' ',.vCityStateZip)),' '))))
vPrintLine5 = (IFEXISTS(Company,(IFEXISTS(AddressLine2,.vCityStateZip,'
')), +
(IFNULL(Company,' ',' '))))
vAddress =
(.vPrintLine1+(CHAR(013))+.vPrintLine2+(CHAR(013))+.vPrintLine3+(CHAR(013))+.vPrintLine14(CHAR(013))+.vPrintLine1+(CHAR(013)))
In this example, the vAddress is defined as "NOTE" and placed as
"Variable Memo"
control with "Stretch" set to true (checked).
Hope that helps!
Very Best R:egards,
Razzak.
P.S. If you need a sample report or label based on this technique, let me
know.
------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.287 / Virus Database: 270.12.8/2086 - Release Date: 04/29/09
06:37:00