ErrorMessages: Array;
ErrorMessages: Array;
The ErrorMessages property returns found errors on creating a project plan.
To execute the example, add a link to the ProjectPlanning system assembly.
Sub UserProc;
Var
Project: IPrjProject;
Tasks: IPrjTaskCollection;
Task: IPrjTask;
Depend: IPrjTaskDependency;
Error: String;
Begin
Project := New PrjProject.Create;
// Set project start date
Project.StartDate := DateTime.Parse("20.02.2020");
Project.UseStartDate := True;
// Get collection of project tasks
Tasks := Project.Tasks;
// Add the first task
Task := Tasks.Add;
Task.Key := 1;
Task.Name := "Task 1";
// Add the second task
Task := Tasks.Add;
Task.Key := 2;
Task.Name := "Task 2";
Task.ParentKey := 2; // parent task key
Depend := Task.Dependencies.Add;
Depend.PredecessorTaskKey := 2;
// Check if project has any errors
If Project.CheckConstraints = 0 Then
Debug.WriteLine("No errors");
Else
For Each Error In Project.ErrorMessages Do
Debug.WriteLine(Error + " ");
End For;
End If;
End Sub UserProc;
After executing the example the console displays messages about errors creating a project:
Error on creating parent links
Work cannot be its own predecessor
See also: