1/25/2016 (9 years ago) | |
Clarify | |
Any | |
1/25/2016 (9 years ago) | |
Windows (Any) | |
Any |
A Dovetail log file may show warnings such as this:
FChoice.Foundation.Clarify.ClarifyGeneric[username|threadId] Maximum rows exceeded for a query, cancelQuery specified by event handler, ending Query processing.
What does this warning mean?
This warning occur when the MaximumRows property is used on a ClarifyGeneric query.
The MaximumRows property controls the maximum number of rows to be returned by the Genric Query.
When this property is set the default operation will result in the number of rows returned by every Query to MaximumRows.
Alternatively the MaximumRowsExceeded event can give greater control of how Queries returning too many rows are handled.
When the MaximumRows property has been exceeded, a warning is logged.
For example, when we get the number of open cases that a user has, rather then querying for all the data and checking the number of rows returned, we use the MaximumRows property on the query, and set it to 1. When this happens, a count() query is executed, so we only get 1 row back, rather than all the open cases.
The Dovetail SDK is logging that the actual query that returns all the case data would have returned more than 1 row, so it doesn’t perform the query to get all the data, and logs that this situation occurred. It’s just a warning, that’s all.
Here is example code demonstrating this scenario:
public EmployeeOpenItems GetEmployeeOpenItems(int employeeDatabaseIdentifier)
{
var filter = FilterType.And(FilterType.Equals("owner_employee_objid", employeeDatabaseIdentifier), FilterType.NotEqual("condition_value", CaseListingAssembler.CaseClosedConditionValue));
var caseCount = GetTableCount("fc_user_case_view", filter);
var subcaseCount = GetTableCount("fc_user_subcase_view", filter);
return new EmployeeOpenItems { OpenCases = caseCount, OpenSubcases = subcaseCount };
}
private int GetTableCount(string tableViewName, Filter filter)
{
var dataSet = _clarifySession.CreateDataSet();
var viewGeneric = dataSet.CreateGeneric(tableViewName);
viewGeneric.MaximumRows = 1;
var totalCases = 0;
viewGeneric.MaximumRowsExceeded += (g, args) =>
{
totalCases = args.TotalPossibleRows;
args.CancelQuery = true;
};
viewGeneric.Filter.AddFilter(filter);
viewGeneric.Query();
if (totalCases == 0)
totalCases = viewGeneric.Count;
return totalCases;
}
If so desired, these warnings can be suppressed from the log file by using a Filter in the log4net configuration.
More information about the MaximumRows property and its associated events can be found in the Dovetail SDK documentation.
You must be logged in to post a comment.
Login