我为我的公司创建了一个自定义应用程序,只要其中只有两个字段,查询就可以正常工作,一旦添加第三个字段,它就不会返回任何记录:
作为参考,我正在查询故事和缺陷:
var query = [];
var queryCriteria = buildQueryFilter(STORIES);
query[0] = {
key : STORIES,
type : "HierarchicalRequirement",
fetch : "FormattedID,Name,Owner,SubProject,CreationDate,Release,Iteration,ScheduleState,State,Build,Parent",
order : "FormattedID",
query : queryCriteria
};
var queryCriteria = buildQueryFilter(DEFECTS);
if (!(showUserStoriesOnly)){
query[1] = {
key : DEFECTS,
type : "defects",
fetch : "FormattedID,Name,Owner,SubProject,CreationDate,Release,Iteration,ScheduleState,State,FixedInBuild,Requirement",
order : "FormattedID",
query : queryCriteria
};
}
rallyDataSource.findAll(query, showResults);
编辑:这是 buildQueryFilter 的一些“缩写”代码:
returnFilter += returnFilter.length === 0 ? '' : ' AND '
returnFilter += '(Iteration.Name = "' + filterIteration + '")';
returnFilter += returnFilter.length === 0 ? '' : ' AND '
returnFilter += '(ScheduleState = "' + filterScheduleState + '")';
returnFilter += returnFilter.length === 0 ? '' : ' AND '
returnFilter += '(Owner = \"__USER_NAME__\")';
returnFilter = '(' + returnFilter + ')';
当“queryCriteria”为:
查询(故事): ((Iteration.Name = "25 (10/02 - 10/16)") AND (ScheduleState = "Accepted"))
查询(缺陷): ((Iteration.Name = "25 (10/02 - 10/16)") AND (ScheduleState = "Accepted"))
有用。但是,一旦我添加了第三个字段 - 无论哪个字段或什么顺序都无关紧要 - 然后它就不再起作用了:
查询(故事): ((Iteration.Name = "25 (10/02 - 10/16)") AND (ScheduleState = "Accepted") AND (Owner = "user@domain.com"))
查询(缺陷): ((Iteration.Name = "25 (10/02 - 10/16)") AND (ScheduleState = "Accepted") AND (Owner = "user@domain.com"))
我一直在查看文档,这应该可以工作。我不确定为什么不是。有人有线索吗?
谢谢!