Dataease 7.2 allows you to attach any file and send it via e-mail.
Assuming a Payroll System and a monthly paysheet is sent to each employee in the company and you need DataEase to attach the paysheet to the email you will send to the employee and send it automatically.
First of all, you can create each paysheet in PDF format via the procedures “Print Options” window. To do this:
-select menu option: Document -> Print Options;
-select the “File” option in the [Document Print Options] dialogue window;
-select “PDF” from the listbox immediately adjacent to the “File” option;
-finally, specify the path where you want the PDF file to be saved in the textbox immediately below the “File” option.
To create the email functionality, first of all create the following CDF:
Function Name: Convert
CDF library name: STRFUNC.DLL
Return type: String
Parameter Name: Character to Convert
Parameter Type: String
Close and re-open your DataEase application (to register the CDF).
You will then need to create 3 procedures as follows. You can simply copy and paste in the code and amend where necessary:
Procedure 1:
–The below DQL which utilises Visual Basic code and executed by a program called “wscript.exe” found in your c:\WINDOWS\system32 folder. This is just one way of creating email functionality within DataEase.
Define Temp “tText1″ Text 100 .
Define Temp “tText2″ Text 100 .
Define Temp “tText3″ Text 100 .
Define Temp “tText4″ Text 100 .
Define Temp “tText4a” Text 100 .
Define Temp “tText5″ Text 100 .
Define Temp “tText6″ Text 100 .
Define Temp “tText7″ Text 100 .
Define Temp “tText8″ Text 100 .
Define Temp “tText9″ Text 100 .
Define Temp “tText10″ Text 100 .
Define Temp “tText11″ Text 100 .
Define Temp “tText12″ Text 100 .
Define Temp “tText13″ Text 100 .
Define Global “gFileName” Text 50 .
Define Global “gFileName2″ Text 50 .
Define Global “gEmail” text 40 .
– Name & path of the first file to attach gFileName := “C:\Paysheet1.pdf”.
– Name & path of the second file to attach (omit if not required)
gFileName2 := “C:\Paysheet2.pdf”.
– email address of the person you want send the email to gEmail :=”EmployeeName@MyDomainName.com”.
tText1 := Concat(“Set oolApp = CreateObject(“, convert(“n34″), “Outlook.Application”, convert(“n34″), “)”) .
tText2 := Concat(“Set email = oolApp.CreateItem(“,”0″,”)”) .
tText3 := Concat(“email.Recipients.Add(” , convert(“n34″), gEmail,convert(“n34″), “)”) .
– Attach file 1. N.B. the file MUST exist in the specific location otherwise the e-mail will not be sent and an error will be displayed
tText4 := Concat(“email.attachments.Add(“, convert(“n34″), gFileName, convert(“n34″), “)”) .
– Attach file 2 (omit if not required). N.B. the file MUST exist in the specific location otherwise the e-mail will not be sent and an error will be displayed tText4a := Concat(“email.attachments.Add(“, convert(“n34″), gFileName2, convert(“n34″), “)”) .
tText5 := Concat(“MailBody = ” , convert(“n34″),”” , convert(“n34″)) .
tText6 := Concat(“MailBody = MailBody & ” , convert(“n34″),”“,convert(“n34″), “& vbcrlf”) .
tText7 := Concat(“MailBody = MailBody & ” , convert(“n34″),”“,convert(“n34″), “& vbcrlf”) .
– Body of the e-mail. N.B. You can use HTML tags to enhance the look and feel
tText8 := Concat(“MailBody = MailBody & ” , convert(“n34″),”THIS IS A SAMPLE EMAIL,
“,convert(“n34″)) .
tText9 := Concat(“MailBody = MailBody & ” , convert(“n34″),”THAT HAS AN
ATTACHMENT
“,convert(“n34″)) .
tText10 := Concat(“MailBody = MailBody & ” ,
convert(“n34″),”“,convert(“n34″)) .
– E-mail Subject
tText11 := Concat(“email.Subject = ” , convert(“n34″),”THIS IS WHERE YOUR SUBJECT HEADER GOES”,convert(“n34″)) .
tText12 := “email.HTMLBody = MailBody” .
tText13 := “email.Send” .
list Records
tText1 ;
tText2 ;
tText3 ;
tText4 ;
tText4a ;
tText5 ;
tText6 ;
tText7 ;
tText8 ;
tText9 ;
tText10 ;
tText11 ;
tText12 ;
tText13 .
Export to “c:\email.vbs” .
.items
@f[1,1]
@f[1,2]
@f[1,3]
@f[1,4]
@f[1,5]
@f[1,6]
@f[1,7]
@f[1,8]
@f[1,9]
@f[1,10]
@f[1,11]
@f[1,12]
@f[1,13]
@f[1,14]
.end
Procedure 2:
–the following code uses wscript to execute the VB code created by the first procedure:
Call Program “c:\windows\system32\wscript.exe c:\email.vbs” .
Procedure 3:
–the following control procedure calls the above two procedures one after the other:
run procedure “PROCEDURE 1″ .
run procedure “PROCEDURE 2″ .
You are now ready to execute PROCEDURE 3.
Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17
Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11
Product: . Written by Marco Marchesi 15/02/16 at 14:50:46
Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44
Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10
Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40