pjohns
19th February 2015, 12:06
Hello,

I have a report which I sending by email where I am selecting the email address from tccom010. If there is no email address in Baan I want the recipient's address to be set to "no_mail_add@xxx.com".

My logic works fine when there is an email address but when there isn't nothing gets entered in to the 'To' field of my email. Can anybody see what this may be happening from the below?

Thanks in advance.

PJ

Report Script Element


itdslsfd05.mail.address.set( fd_mfrom,
fd_mto)


Function Element


ref domain tcmcs.s999 o_mfrom,
ref domain tcmcs.s999 o_mto)
{
o_mfrom = "xxxxxx@xxx.com"

| Read mail addresses here.

select tccom010.mail:o_mto
from tccom010
where tccom010._index1 = { :tdsls040.cuno }
as set with 1 rows
selectdo

selectempty

o_mto = "no_mail_add@xxx.com"

endselect

}

vahdani
19th February 2015, 13:23
Hi,

the selectempty-part is never entered as the customer is always found!

Possible solution: Add the following line to your select statement:


select tccom010.mail:o_mto
from tccom010
where tccom010._index1 = { :tdsls040.cuno }
and tccom010.mail <> "" |<<< add this line
as set with 1 rows
selectdo

selectempty

o_mto = "no_mail_add@xxx.com"

endselect

pjohns
19th February 2015, 13:39
Thanks Vahdani,

That worked.