Daniel,
Your points are taken. See modified version in the FAQ :)
>Nadya:
>
>Sorry for not being precise: performance is about the same if you have to build the index. GetMedian is MUCH faster if the index already exists. I played a little bit with your functions and I came up with a few things.
>
>Note 1
>------
>In GetMediam, you have to change one line from
> lnMedianValue=evaluate(lcTableName + '.' + pcField)
>to
> lnMedianValue=evaluate(lcCursor + '.' + pcField)
>in order to work.
>
>Note 2
>------
>In GetMedianValue, you should have two distict SELECT SQL statements:
>One with the WHERE clause and one without. This will increase performance if tcWhere is empty.
>
>Note 3
>------
>GetMedian cannot have an equivalent FILTER clause because its logic breaks down if one record is filtered out (including current filter) or if a record is deleted.
>
>
>I personnally stay away from stuff like GetMedian because it requires some housekeeping code. I tend to write stuff in SQL because I find it much easier to debug and maintain.
>
>My .02 worth,
>
>Daniel
If it's not broken, fix it until it is.
My Blog