Greetings to Bergsoft community,
well, this is second time i noticed a weird nextgrid behaviour on calculating footer with sum() function.
This time i did not succumb to laziness instincts and have bit poked around the sources to find the culprit at fault.
version 5.9.50
Bug occurs only when populated grid contains mostly invisible rows with few visible ones in combination with any column (i think or the summed ones?) is sorted descending.
when CalculateFooter is called again, footer contains wrong values. It does not mater if visibility check is true or false, because in my case invisible rows do contain 0 values.
i am no brainiack nor a programmer, temporary patched following subfunction in nxgrid.pas
procedure ColumnSum(Index: Integer; var Sum: Double); var I: Integer; begin Sum := 0; for I := 0 to RowCount - 1 do begin if (not VisibleOnly or RowVisible[I]) and IsCalculateRow(I) then Sum := Sum + Cell[Index, I].AsFloat; end; end; { procedure ColumnSum(Index: Integer; var Sum: Double); var I: Integer; begin for I := 1 to Pred(RowCount) do if (not VisibleOnly or RowVisible[I]) and IsCalculateRow(I) then Sum := Sum + Cell[Index, I].AsFloat; end; }
i probably did broke a dozen other calculation behaviours of this function.... but what the heck, didn't see anything else turnin bad
forgot to mention an important thing, am using Delphi XE2 with 4th update