I never noticed it before but I am getting incorrect values for various duration values. I am getting incorrect values for Baseline.Duration, Duration
I am getting the correct value for ActualDuration. Not sure why I never caught this before
I never noticed it before but I am getting incorrect values for various duration values. I am getting incorrect values for Baseline.Duration, Duration
I am getting the correct value for ActualDuration. Not sure why I never caught this before
Hi,
I have included a sample file so you can replicate the same problems that I am seeing.
When I read the data for "Task 1" I am getting a Duration of 2 days?? MSProject is showing 6 days?? You will see the same problem with the ActualDuration value as well.
Then for the StartVariance and FinishVariance it will always return 0. In this sample it should be 1 day for "Task 1" and -1 day for "Task 2.1". Also your datatype return is int and it says it is in minutes?? Should the correct datatype be a TimeSpan so we can convert the units to what ever we want?
This is also in relation to this post as well
<A href="https://forum.aspose.com/t/4794</A></P>
Hi,
I have used a code below to check the issue:
using System;
using Aspose.Tasks;
using Aspose.Tasks.Util;
namespace TestDuration
{
class Program
{
static void Main(string[] args)
{
License license = new License();
license.SetLicense("Aspose.Tasks.lic");
ProjectReader reader = new ProjectReader();
Console.WriteLine(string.Format("Project's format: {0}.",
reader.ReadProjectFileInfo("Sample Project.mpp").ProjectFileFormat));
Project project = reader.Read("Sample Project.mpp");
ChildTasksCollector collector = new ChildTasksCollector();
TaskUtils.Apply(project.RootTask, collector, 0);
foreach (Task task in collector.Tasks)
Console.WriteLine(string.Format("Task '{0}' has duration '{1}'.",
task.Name, task.Duration));
ProjectWriter writer = new ProjectWriter();
writer.Write(project, "project.xml", TasksDataFormat.XML);
Console.ReadLine();
}
}
}
I have opened both projects in the same window and compared them. See screen shot attached.
I can not see any difference in the durations. MS Project shows the durations in working days, which is in your case 8 hours long and my code shows 48 hours TimeSpan value as well (2 * 24 = 6 * 8). When I open the resulting XML MS Project uses the specified duration format and converts them to 6 working days as well.
Start and Finish variants are calculated values and we unfortunately do not calculate them when read the data from MPP now. I am going to link a new issue to your correspondent thread.
Sorry for inconvenience.
Then I am confused here. Why would it be necessary to do another calculation on the duration field based on the hours per day?? Why can’t this be handled internally. I have not seen this documented anywhere on your site. Seems very misleading. When I read from a field I would expect it to be correct without any additional manipulation, unless I want it in a different unit of measure with a TimeSpan already provides
Hi,
I had exactly the same reaction when I read the response ... then I went to the MS Project object model and then realised that all that is returned for duration is 'minutes'.
I have already converted the 'effort' in minutes to various values (hours / days ... etc) to present useful information.
I was thinking that to interpret the minutes, the calendar is needed to ensure that only working time is taken into account... Maybe there are some routines to help convert minutes into elapsed time or different units - these might be useful...
My application is a bit different in that I really only use the start and finish dates.
Thanks for raising all of your issues..
Regards, Bruce
Hi,
Hi Sergey,
You are right ... I forgot the Duration Format. This is clear in the XML and does clarify how to interpret the Duration value.
Regards, Bruce
(I've been spending too much time with Effort ... in minutes.. :-)
I really really wish using the Xml format from MSProject was an option for me. Not sure if it is something that my company does to create the files or if it is MSProject itself, but when I try to save the file as Xml it freezes and never finishes. I even started it and left for lunch and came back at it was still frozen. Not sure if this is the same problem why I cannot get Aspose.Tasks to read the file. I really wish I could provide a sample file to have you guys help me out.
As for my above question, it would be easy enough for me to add in my code to manually figure out the working hours in the days between the Start and Finish for the Duration field and then multiple that by the hours returned by the Duration property. But the approach I am using makes this difficult because I am actually using reflection to map MSProject columns into a common database schema. The reason I am doing this is because my company has may different groups/divisions/teams, or what ever you want to call them, and they structure their MSProjects in countless ways. So I want to be able to support any unique structure but still be able to bring everything into a common database schema. I can then write reports and other misc output that can support all groups/divisions/teams and also rollup reports into higher level groups/divisions/teams for management. I really want to stay away from hard coding something for when Property == "Duration" Then Do This...
I guess another option I will have is to use reflection again to call another method that can pass other Aspose.Task properties as parameters so it can have the Start and Finish values to calculate the Duration. This will prevent any hard coding and will keep all the business logic in the my Xml based mapping methodology. But this will add a considerable amount of overhead if the MSProject files has thousands of tasks, which in most cases they do.
Any help you can provide here will be greatly appreciated!!
Hi,
Here is another reason I have a problem with manually calculating the duration field to days. There is some business logic that defines which two date fields MSProject uses in order to calculate the various duration values. Then if I use your calendar functions I need to have a starting date and finishing date to evaluate the working hours per each day to convert the hours to days. If I "hard code" the starting and finishing dates of the various durations then that is duplicate business logic in different methods. This leaves me open to big problems if MSProject decides to change which date fields it chooses to calcuate the duration values. This should be transparent to anything outside the Aspose classes.
If you could create a method that does what this forum thread does
http://www.aspose.com/community/forums/191298/v1-to-v2-duration-change/showthread.aspx#191298
That would be extremely helpful and wouldn't require deveopers to "hard code" which start and finish dates are required to convert hours to days. This way there won't be a discrepancy with what MSProject displays and what Aspose.Tasks outputs
Let me know if you think this might be possible
Hi,
Hi Chris,
I am still unable to get the correct duration value between the start and finish dates of a task using the following two methods
I am not sure of the structure of the source MSProject file that is being provided to me. I do know that there are MANY calendars in the file. Also not sure if you can assign multiple calendars to calculate the duration of a given task in MSProject. As of right now I can’t come close to the correct value
Dear Chris,
I can calculate the duration and it gives me the correct duration values. Please check the first sample 'DurationCalculation.zip' file for reference.
You can also calculate the duration of a task according to multiple calendars. Please check the second sample 'DurationCalculation1.zip' file for reference.
Please also check input and output images and feel free to contact us in case you have further comments or questions.
Best Regards,
I wish I could do more to help you with my problem but I can’t send my to you to verify since it has company proprietary information. But I am guess we have some strange calendar setup since I cannot get the same result that you are showing. If I fill out a blank file with no calendars I get the same value as you are getting. But with my source file I don’t get the correct value
Project Task should be 1541 and I am getting 1575
Task 1 should be 38 and I am getting 39
Task 2 should be 223 and I am getting 228
1.) My license has expired so the latest build returns the year 2000, but I have been overriding that date manually. I am getting the exact same answer with the last build I can use with my license. So this does not appear to be the issue
2.) I am aware of this and have been checking both these values. If you look at the screen shots I provided you will notice that it showed two sets of values, one was using the Project Calendar and the other was the Task Calendar if not null. So this does not appear to be the issue
3.) This schedule is not resource loaded so there shouldn’t be any resource calendar overriding the duration. So this doesn’t appear to be the issue
As for sending you the file, even if I remove everything that is company proprietary data it is against corporate policy. I really wish I could send you the file, which would help us both out tremendously. There is obviously something different with our file, since when I create a file from scratch I get the same values that your product calculates. Unfortunately I don’t know enough about MSProject to know what is wrong
Hi,
If you created a file from scratch and do get the same answers as Aspose, maybe there are some settings that are not quite the same in the two files. I have found that MS Project is very sensitive to the values in the Tools >> Options (or what ever the current menu options are). Any one of the values can have slight differences in the calculations. (I'm sure you have checked these values ... it's just worth double checking that the test case has exactly the same settings as the main file you are using). There is also a Global.mpt file (I think this is the file name ... there could be some settings in this file that are not overridden by the main file).
These can be checked by saving both of the MPP files as XML and then just doing a text compare ... this might show up some variations ... especially since the problem is related to calculations not anything else.
I hope that you find the answer ... (the above is just a thought as I've run into problems like this before).
Regards, Bruce
The issues you have found earlier (filed as TASKS-17414) have been fixed in this update.
The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.