EntitySet: Tasks (ProjectData service)

In this article
Definition
Attributes
Parent element
Child elements

Specifies the collection of tasks in the ReportingData schema.

Definition

<EntitySet Name="Tasks" EntityType="ReportingData.Task" />

Attributes

Attribute

Value

Description

Name

Tasks

The name of the entity set.

EntityType

ReportingData.Task

The type of entity.

Parent element

Element

Description

EntityContainer element: ReportingData

Contains definitions of entity sets for internal use in queries of the online Reporting database.

Child elements

None

Example

The following statement uses LINQ query syntax to retrieve Task entity data from the OData interface of the Project Server reporting tables. To use the statement in an application, set a service reference to the ProjectDataService, and initialize the ReportingData context. The Tasks entity set can then be accessed as context.Tasks. For more information, see Querying OData feeds for Project 2013 reporting data.

var query =
    from t in Tasks
    where (t.TaskIndex > 0)
    orderby t.ProjectName, t.TaskIndex
    select new
    {
        Project = t.ProjectName,
        Task = t.TaskName,
        TaskWork = t.TaskWork,
        TaskCost = t.TaskCost,
        TaskDuration = t.TaskDuration,
        TaskDurationVariance = t.TaskDurationVariance,
        TaskCostVariance = t.TaskCostVariance
    };

The preceding statement can be written by using Lambda expression syntax, as follows:

var query = Tasks
    .Where(t => (t.TaskIndex > (Int32)0))
    .OrderBy(t => t.ProjectName)
    .ThenBy(t => t.TaskIndex)
    .Select(t => new
    {
        Project = t.ProjectName,
        Task = t.TaskName,
        TaskWork = t.TaskWork,
        TaskCost = t.TaskCost,
        TaskDuration = t.TaskDuration,
        TaskDurationVariance = t.TaskDurationVariance,
        TaskCostVariance = t.TaskCostVariance
    });

Either statement creates the following REST URL (all on one line).

https://ServerName/pwa/_vti_bin/client.svc/ProjectServerData/Tasks()?
     $filter=TaskIndex gt 0&
     $orderby=ProjectName,TaskIndex&$select=ProjectName,TaskName,TaskWork,
     TaskCost,TaskDuration,TaskDurationVariance,TaskCostVariance

All three of the sample queries get the same data.

Sample results of the Task query

Project

Task

TaskWork

TaskCost

TaskDuration

TaskDurationVariance

TaskCostVariance

ProjectA

T1

24.0 hrs

$404.00

24.0 hrs

0.0 hrs

$0.00

ProjectA

T2

8.0 hrs

$156.00

8.0 hrs

-16.0 hrs

-$272.00

ProjectA

T3

32.0 hrs

$564.00

32.0 hrs

8.0 hrs

$136.00

ProjectB

T1

48.0 hrs

$836.00

48.0 hrs

16.0 hrs

$272.00

ProjectB

T2

24.0 hrs

$428.00

24.0 hrs

0.0 hrs

$0.00

ProjectB

T3

40.0 hrs

$740.00

40.0 hrs

0.0 hrs

$0.00

ProjectB

T4

8.0 hrs

$168.00

8.0 hrs

-8.0 hrs

-$168.00

Remarks

Each entity set has a specific page-size limit. For information about page limits for on-premises and online ProjectData queries and how to set the on-premises page limit, see ProjectData - OData service reference.