English

Bug: Invalid results when using IDataStatistics with IDataStatistics.Cursor

Description

IDataStatistics.Statistics and IDataStatistics.UniqueValues do not always process the cursor supplied to the DataStatistics object through IDataStatistics.Cursor. The results are not accurately computed.

Cause

The cursor, processed by the DataStatistics object, is set by IDataStatistics.Cursor. Like all cursors, it is a read-once cursor; however, both IDataStatistics.Statistics and IDataStatistics.UniqueValues iterate through the cursor. That means that if the cursor is set and then both IDataStatistics.Statistics and IDataStatistics.UniqueValues are called, the second method will not iterate through the cursor because it is already at the end.

Workaround

Always set IDataStatistics.Cursor to be a new cursor that has not been iterated through, before calling either IDataStatistics.Statistics or IDataStatistics.UniqueValues.