Progress bar doesn't appear

Hi, in an server side application (c#) I create some tasks and set some attributes depending on informations but even if I add some actual work and set actual start date, the progress bar are not displayed when I open the file (it’s a brand new file created from scratch with an upload stream)
Here is a sample of my code

docTask.Set(Tsk.Type, TaskType.FixedWork);
            docTask.Set(Tsk.IsEffortDriven, true);
            docTask.Set(Tsk.DurationFormat, TimeUnitType.Day);
            docTask.Set(Tsk.ConstraintType, ConstraintType.StartNoEarlierThan);
            docTask.Set(Tsk.Hyperlink, docTask.Get(Tsk.Name));
            docTask.Set(Tsk.HyperlinkAddress, lotDoc.MFilesURL(false, MFilesURLType.MFilesURLTypeOpen, UrlTargetPlatform.Desktop));
            docTask.Set(Tsk.Start, startDate);
            docTask.Set(Tsk.ConstraintDate, startDate);
            docTask.Set(Tsk.Duration, project.GetDuration(lotDoc.GetPropertyAs<double>(Configuration.PlanSettings.CalculatedSettings.PDCalculatedDuration), TimeUnitType.Day));
            docTask.Set(Tsk.Work, project.GetDuration(lotDoc.GetPropertyAs<double>(budgetWorkPD), TimeUnitType.Hour));
            
            if(lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD)>0 && advancementPD < 100)
            {
                docTask.Set(Tsk.ActualWork, project.GetDuration(lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD), TimeUnitType.Hour));
                docTask.Set(Tsk.ActualStart, lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.ActualSettings.PDActualStartDate));
                docTask.Set(Tsk.Finish, lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.CalculatedSettings.PDEndDate));
            }
            if (lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD) > 0 && advancementPD >= 100)
            {
                docTask.Set(Tsk.ActualWork, project.GetDuration(lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD), TimeUnitType.Hour));
                docTask.Set(Tsk.ActualStart, lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.ActualSettings.PDActualStartDate));
                docTask.Set(Tsk.ActualFinish, lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.ActualSettings.PDActualEndDate));
            }
            docTask.Set(Tsk.Work, project.GetDuration(lotDoc.GetPropertyAs<double>(budgetWorkPD), TimeUnitType.Hour));

As you can see on this screenshot the tasks seems to be created correctly with actual work and actualstart date but the progress bar aren’t there…
CaptureGCV1.JPG (117.0 KB)

@Zan135

Can you please share the source MPP file and also the generated MPP. Please also share the working sample code that we may use on our end to reproduce and log the issue. I am also assuming that you are using latest Aspose.Tasks for .NET 21.2 on your end.

Hi @mudassir.fayyaz as I said there’s no source MPP file, I create a new empty file and use stream to save the result in it, but here is the generated filePlanning Test.zip (26.4 KB)

I use 21.2.0 Aspose Tasks for.NET

The whole code is a bit long with many reference to third party API methods used to populate tasks and their attributes, so I don’t know how to do that…?

First I create the “project” task
Aspose.Tasks.Task projectTask = project.RootTask.Children.Add(projectObject.Title);
then sub tasks (in a for each loop) like this
Aspose.Tasks.Task lotTask lotTask = projectTask.Children.Add(lotObject.Title);
and inside these “lotTask” other sub tasks in a other for each loop
Aspose.Tasks.Task docTask docTask = lotTask.Children.Add(lotDoc.Title);
Then for these tasks I populate task attributes with a method
SetMFilesProperties(project, docTask, lotDoc, budgetWorkPD, actualCalculatedWorkPD, advancementPD);
where budgetWorkPD, actualCalculatedWorkPD and advancementPD are key ID to get double values of lotDoc attibutes (in my third party app).
The sample code of my first post is this “SetMFilesProperties” method.

here

public void SetMFilesProperties(Project project, Aspose.Tasks.Task docTask, ObjVerEx lotDoc,int budgetWorkPD,int actualCalculatedWorkPD,int advancementPD)
        {
            DateTime startDate;
            if (!lotDoc.HasValue(Configuration.PlanSettings.CalculatedSettings.PDStartDate))
            {
                startDate = DateTime.Now;
            }
            else
            {
                startDate = lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.CalculatedSettings.PDStartDate);
            }
            
            docTask.Set(Tsk.Type, TaskType.FixedWork);
            docTask.Set(Tsk.IsEffortDriven, true);
            docTask.Set(Tsk.DurationFormat, TimeUnitType.Day);
            docTask.Set(Tsk.ConstraintType, ConstraintType.StartNoEarlierThan);
            docTask.Set(Tsk.Hyperlink, docTask.Get(Tsk.Name));
            docTask.Set(Tsk.HyperlinkAddress, lotDoc.MFilesURL(false, MFilesURLType.MFilesURLTypeOpen, UrlTargetPlatform.Desktop));
            docTask.Set(Tsk.Start, startDate);
            docTask.Set(Tsk.ConstraintDate, startDate);
            docTask.Set(Tsk.Duration, project.GetDuration(lotDoc.GetPropertyAs<double>(Configuration.PlanSettings.CalculatedSettings.PDCalculatedDuration), TimeUnitType.Day));
            //docTask.Set(Tsk.Work, project.GetDuration(lotDoc.GetPropertyAs<double>(budgetWorkPD), TimeUnitType.Hour));
            docTask.Set(Tsk.Work, project.GetWork(lotDoc.GetPropertyAs<double>(budgetWorkPD)));

            if (lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD)>0 && advancementPD < 100)
            {
                docTask.Set(Tsk.ActualWork, project.GetWork(lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD)));
                //docTask.Set(Tsk.ActualWork, project.GetDuration(lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD), TimeUnitType.Hour));
                docTask.Set(Tsk.ActualStart, lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.ActualSettings.PDActualStartDate));
                docTask.Set(Tsk.Finish, lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.CalculatedSettings.PDEndDate));
            }
            if (lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD) > 0 && advancementPD >= 100)
            {
                docTask.Set(Tsk.ActualWork, project.GetWork(lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD)));
                //docTask.Set(Tsk.ActualWork, project.GetDuration(lotDoc.GetPropertyAs<double>(actualCalculatedWorkPD), TimeUnitType.Hour));
                docTask.Set(Tsk.ActualStart, lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.ActualSettings.PDActualStartDate));
                docTask.Set(Tsk.ActualFinish, lotDoc.GetPropertyAs<DateTime>(Configuration.PlanSettings.ActualSettings.PDActualEndDate));
            }
            docTask.Set(Tsk.Work, project.GetWork(lotDoc.GetPropertyAs<double>(budgetWorkPD)));
            //docTask.Set(Tsk.Work, project.GetDuration(lotDoc.GetPropertyAs<double>(budgetWorkPD), TimeUnitType.Hour));
        }

I hope with these information you will be able to help me.
Regards

@Zan135

I have created a ticket with ID TASKSNET-4720 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@Zan135

We have investigated the issue and have observed that the progress bars are not visible because “Stop” and “Resume” properties are not set properly. Probably you have set properties using CalculationMode.Manual and doesn’t set “Stop” and “Resume” properties according to ”% Complete” property. When CalculationMode.Auto is used, these properties are calculated automatically when Tsk.PercentComplete (”% Compete” in MS Project) property is set.

Screenshot_1.png (15.9 KB)
Screenshot_2.png (9.4 KB)