FtpAddress: String;
The FtpAddress property determines the path to the FTP folder, in which the calculated report is saved.
Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier and a regular report with the Report_1 identifier.
Sub UserProc;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
CalcReport: ICalculateReportScheduledTask;
Per: IScheduledTaskPeriodOneTimeOnly;
Prop: IScheduledTaskProperties;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_CALCULATEREPORT;
CrInfo.Id := "CALCULATE_REPORT";
CrInfo.Name := "Calculate regular report";
CrInfo.Parent := MB.ItemById("TASK_CONTAINTER");
MObj := MB.CreateObject(CrInfo).Edit;
CalcReport := MObj As ICalculateReportScheduledTask;
CalcReport.FormatTag := "xls";
CalcReport.SourceReport := MB.ItemById("Report_1").Bind As IPrxReport;
Prop := CalcReport.Properties;
Per := Prop.CreatePeriod(ScheduledTaskPeriodType.OneTimeOnly) As IScheduledTaskPeriodOneTimeOnly;
Per.StartMode := TaskPeriodOneTimeStartMode.OnLogon;
Prop.Period := Per;
Prop.MailAddress := "User1@Mail.ru";
Prop.FtpAddress := "ftp://10.0.0.1/Report"
MObj.Save;
End Sub UserProc;
After executing the example a new task of the regular report calculation is created in the scheduled tasks container. The calculation is performed on connecting to repository. Calculation report is sent to the specified email address. Calculated report exported to the XLS format is attached to the letter as an application. The exported file is also put into the specified folder on FTP server.
See also: