Share all details related to your problem, including any error messages you may have received.
Hello all,
I am trying to write a filter to fetch scheduled task results that have failed. This is what I have:
QueryOptions qo1 = new QueryOptions();
Filter f1 = Filter.notnull("schedule");
Filter f2 = Filter.or(Filter.eq("completionStatus","failed"),Filter.eq("completionStatus","error");
qo1.addFilter(Filter.and(f1,f2));
Upon testing, I am getting all the failed task results. It almost looks like f1 is not being evaluated. What am I doing wrong here? what should I be doing ?
TIA
I tested your code in my environment and its working as expected.
The closing parentheses is missing in your above code for filter f2, idk if you forgot to put it here during copy paste.
QueryOptions qo1 = new QueryOptions();
Filter f1 = Filter.notnull("schedule");
Filter f2 = Filter.or(Filter.eq("completionStatus","failed"),Filter.eq("completionStatus","error"));
qo1.addFilter(Filter.and(f1,f2));
return (context.countObjects(TaskResult.class,qo1));
sorry, I missed that while pasting here. That is strange. I am getting all the failed task results (scheduled and ad hocs). Are you sure you are only getting scheduled task results?
thanks for your response. your code is not very different from mine, only thing different is the map. So I am kind of baffled as to why I am getting a different result from all of you.