Resource.GetTimephasedData

GetTimephasedData(DateTime, DateTime, TimephasedDataType)

Returns an instance of the TimephasedDataCollection class for this object with the TimephasedData values within given start and end dates of specified TimephasedDataType.

public TimephasedDataCollection GetTimephasedData(DateTime start, DateTime end, 
    TimephasedDataType timephasedType)
ParameterTypeDescription
startDateTimeThe start date for the time phased data.
endDateTimeThe end date for the time phased data.
timephasedTypeTimephasedDataTypeThe type of time phased data (TimephasedDataType).

Return Value

List of TimephasedData.

Examples

Shows how to read timephased data of work/cost resources.

var project = new Project(DataDir + "ResourceTimephasedData.mpp");

// Get the Resource by its ID
var resource = project.Resources.GetByUid(1);

// Print Timephased data of ResourceWork
Console.WriteLine("Timephased data of ResourceWork");
foreach (var td in resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate)))
{
    Console.Write("Start: " + td.Start.ToShortDateString());
    Console.WriteLine(" Work: " + td.Value);
}

// Print Timephased data of ResourceCost
Console.WriteLine("Timephased data of ResourceCost");
foreach (var td in resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate), TimephasedDataType.ResourceCost))
{
    Console.Write("Start: " + td.Start.ToShortDateString());
    Console.WriteLine(" Cost: " + td.Value);
}

See Also


GetTimephasedData(DateTime, DateTime)

Returns TimephasedDataCollection for this object with TimephasedDatavalues within given start and end dates.

public TimephasedDataCollection GetTimephasedData(DateTime start, DateTime end)
ParameterTypeDescription
startDateTimeThe start date for the time phased data.
endDateTimeThe end date for the time phased data.

Return Value

List of TimephasedData.

Examples

Shows how to read timephased data of work/cost resources.

var project = new Project(DataDir + "ResourceTimephasedData.mpp");

// Get the Resource by its ID
var resource = project.Resources.GetByUid(1);

// Print Timephased data of ResourceWork
Console.WriteLine("Timephased data of ResourceWork");
foreach (var td in resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate)))
{
    Console.Write("Start: " + td.Start.ToShortDateString());
    Console.WriteLine(" Work: " + td.Value);
}

// Print Timephased data of ResourceCost
Console.WriteLine("Timephased data of ResourceCost");
foreach (var td in resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate), TimephasedDataType.ResourceCost))
{
    Console.Write("Start: " + td.Start.ToShortDateString());
    Console.WriteLine(" Cost: " + td.Value);
}

See Also