I would combine the three email addresses into a single variable before
printing and see if that works.
See below
declare c1 cursor for select distinct(opunit) from treport +
where opunit = '15511200' order by opunit
open c1
fetch c1 into vspeed vi1
while sqlcode <> 100 then
select empmail1, empmail2, empmail3 into vempn1 indicator viempn1, +
vempn2 indicator viempn2, vempn3 indicator viempn3 from byuemail +
where theopunit = .vspeed
set var vfilename = ('Sig Card Entries' & .vspeed & (ctxt(.vpostdate)))
set var vemailto = (.vempn1 + ',' + .vempn2 + ',' + .vempn3)
print rday where opunit = .vspeed option pdf|filename &vfilename.pdf +
|Open OFF +
|Email ON +
|Email_host gateway.byu.edu +
|Email_To_List &vemailto +
|Email_From_name Glenn Smith +
|Email_From_Address [email protected] +
|Email_Subject &vfilename +
|Email_BCC_List [email protected] +
|Email_Body For Your Review +
|Email_Delete_After_Send OFF +
|Email_Show_Dialog_ OFF
fetch c1 into vspeed vi1
endwhile
drop cursor c1
Dan
PS you do not need the order by on the select statement. When you do distinct
it automatically sorts them ascending.
--------------------------------------------------
From: "Glenn Smith" <[email protected]>
Sent: Tuesday, June 28, 2011 12:37 PM
To: "RBASE-L Mailing List" <[email protected]>
Subject: [RBASE-L] - Re: Printing with Email Option
Interesting approach. Thanks.
Continued Problem:
After correcting my "fetch" statement error, I continue to get the same
results. I added a second hard coded "opunit" using a "where in" clause and
moved the 2nd and 3rd email variables to a cc line and both emails ran with the
appropriate copy.
Taking the hard coding out and the email is only sent to the first variable
address and the bcc address (static). Any additional thoughts?
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dennis McGrath
Sent: Tuesday, June 28, 2011 10:49 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Printing with Email Option
Which is why I use a single fetch syntax.
One less thing to forget......
WHILE (1) = (1) THEN -- Endless loop, use BREAK to exit
Fetch ......
If SQLCODE = 100 THEN
BREAK
ENDIF
-- code here
ENDW
Dennis McGrath
Software Developer
QMI Security Solutions
1661 Glenlake Ave
Itasca IL 60143
630-980-8461
[email protected]
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of A. Razzak Memon
Sent: Tuesday, June 28, 2011 11:24 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Printing with Email Option
At 12:07 PM 6/28/2011, Glenn Smith wrote:
>If I hard code for "opunit", I get a single pass - and the report
>is sent to all three addresses. If I run the cursor for all values
>(take out the where clause), emails are only sent to the first
>variable address. The second two are ignored. Any thoughts?
Glenn,
Looking closely at your code, the second FETCH variables do not
match the first FETCH variables. Thus, the result is such behavior.
Hope that provides you with some blue's clues ...
Very Best R:egards,
Razzak.