Total Float in days calculation

Hi,

Primavera has a dynamic way to set number of hours in a day.
It could be 8 hours a day or 10 hours a day based on the calendar set by the scheduler.

When I use the task.totalslack property it returns the value in hrs. How can I convert it into days based on the value set in XER file?

Is there a way to directly get the value in days from XER file?

@abhargava

To convert the task.totalslack property from hours to days based on the calendar settings in your XER file, follow these steps:

  1. Retrieve the total slack in hours using the task.totalslack property.
  2. Determine the number of working hours per day from the calendar settings in your XER file.
  3. Divide the total slack in hours by the number of working hours per day to obtain the total slack in days.

Here’s a code snippet to illustrate this process:

// Assuming you have loaded your project and have access to the task
double totalSlackInHours = task.Totalslack; // Get total slack in hours
double workingHoursPerDay = GetWorkingHoursPerDayFromXER(xerFilePath); // Implement this method to read from XER

double totalSlackInDays = totalSlackInHours / workingHoursPerDay;

You will need to implement the GetWorkingHoursPerDayFromXER method to extract the working hours from your XER file according to your specific requirements.

Please note that there is no direct method to retrieve total slack in days from the XER file; this conversion must be performed manually as demonstrated above.

If you require further assistance with reading the XER file or have specific implementation questions, feel free to ask!

Please understand my question as working hours in a day is what I want to extract from XER file as this is dynamic for each task based on calendar applied to each task.

@abhargava ,
the Aspose.Tasks API is based on MS Project’s model and doesn’t have a support for per-calendar “Hours per Day” settting, “Hours per Day” setting is project-scoped.

We can add calendar-specific “Hours per Day” and other “Time Period” settings to public API so it can be used by the user to format durations properly.

How do I get Project sepecfic hours per day for an XER file?

@abhargava ,

Project project = new Project("input.xer");
var hoursPerDay = project.MinutesPerDay / 60D;

Hi,

The issue here is when I am using the conversion to Days from hours as below:
task.TotalSlack.TotalDays * 3 is whn I am getting the wrong value in my slack. As the calculation is done on the basis of 8 hrs per day whereas in the XER file it is 10 hrs per day.

So I want to understand the process to get it to each task level and understand what calendar has been applied on that task and what is the hrs per day on that particular task/activity in the XER file.

I am fine even if I get the default value for No of Hrs per day from the base calendar. Like is it 6 hrs per day = 1 day or 8 hrs per day = day or 10 hrs per day = 1 day.

how can I get this functionality if it is already available for an XER file? Is there anything you can get from XER relating to Hoursperday to expose it to the API?

@abhargava ,

We can add reading of calendar-specific “Hours per Day” to public API in our API in a future release.
Now it is not present in the API.

@abhargava
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): TASKSNET-11583

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.