Can I modify this query string to filter a search resulting with only tasks who's owners are team members of the current project?

This is the query I have so far which is working besides the team members statement

queryObject = { key: "tasks", type: "Task", fetch: "FormattedID,Owner,DisplayName,Name,State,Estimate,ToDo,Iteration,Name", query: ' (((State = "Completed") AND (Iteration = ' + selectedItr + ')) AND (Project.TeamMembers contains Owner))' };
有帮助吗?

解决方案

Unfortunately you can't get all the data in one query. You can get your team members first and then build an ORed query with all of their refs to and do a second query for their tasks:

var rallyDataSource = new rally.sdk.data.RallyDataSource('__WORKSPACE_OID__', 
                                              '__PROJECT_OID__',
                                               '__PROJECT_SCOPING_UP__', 
                                              '__PROJECT_SCOPING_DOWN__'); 

var teamMembersQuery = { key: "teamMembers", type: "User", 
    fetch: "UserName", query: '(TeamMemberships = /project/__PROJECT_OID__)'};

rallyDataSource.findAll(teamMembersQuery, function(results) {
    var ownerQueries = [];
    rally.forEach(results.teamMembers, function(teamMember) {
        ownerQueries.push('Owner = ' + teamMember._ref);
    });

    var taskQuery = {key: "tasks", type: "Task", 
        fetch: "FormattedID,Owner,DisplayName,Name,State,Estimate,ToDo,Iteration,Name", 
        query: rally.sdk.util.Query.and(['State = "Completed"', 'Iteration = ' +
        selectedItr]).and(rally.sdk.util.Query.or(ownerQueries)) };

   rallyDataSource.findAll(taskQuery, function(results) {
       //process results.tasks here
   });

});

For more examples of writing advanced queries see the App SDK's RallyDataSource help: http://developer.rallydev.com/help/data-examples

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top