anchor.diff:      function Get(const aIndex : integer): TmGroupByDef;
     end;
   
  -  TmCalculationKind = (ckSum, ckCount, ckMin, ckMax);
  +  TmCalculationKind = (ckSum, ckCount, ckMin, ckMax, ckFormula);
   
     { TmCalculationDef }
   
  
positive.code: 
  uses
    contnrs, db, variants, Classes,
    mVirtualDataSet, mVirtualDatasetDataProvider,
    mBaseClassesAsObjects,
    StrHashMap;
  
  type
  
    TmGroupByOperationKind = (gpoDistinct, gpoDateYear, gpoDateMonth, gpoDateDay, gpoFirstLetter);
  
    { TmGroupByDef }
  
  
negative.code:     FIndex.GetValueList(Self.GetIndexKeyValue(tmpValue, FVerticalGroupByDefs.Get(newCurrentGroupByDefIndex))).Add(pointer(aCurrentRecNo)); //@tmpRecNoShell);
    end;
  end;
  *)
  
  procedure TmVirtualDatasetPivoter.Calculate;
  var
    i, recCount : Cardinal;
    k : integer;
    tmpValue : Variant;
    tmpKeyValue : String;
    currentCoord : TRecordCoordinates;
  begin
    FGarbage.Clear;
  
    FVerticalValues := nil;
    FHorizontalValues := nil;
  
    SetLength(FVerticalValues, FVerticalGroupByDefs.Count);
    SetLength(FHorizontalValues, FHorizontalGroupByDefs.Count);
  
    FVerticalRecordCoordinates.Clear;
    FHorizontalRecordCoordinates.Clear;
  
    recCount := FVirtualDataset.DatasetDataProvider.GetRecordCount;
    for i:= 0 to recCount -1 do
    begin
      currentCoord := FVerticalRecordCoordinates.Add;
      for k := 0 to FVerticalGroupByDefs.Count -1 do
      begin
        FVirtualDataset.DatasetDataProvider.GetFieldValue(FVerticalGroupByDefs.Get(k).FieldName, i, tmpValue);
        tmpKeyValue := GetIndexKeyValue(tmpValue, FVerticalGroupByDefs.Get(k));
        if not FVerticalValues[k].Contains(tmpKeyValue) then
          FVerticalValues[k].AddValue(tmpKeyValue);
        currentCoord.Values[k] := tmpKeyValue;
      end;
      currentCoord := FHorizontalRecordCoordinates.Add;
      for k := 0 to FHorizontalGroupByDefs.Count -1 do
      begin
        FVirtualDataset.DatasetDataProvider.GetFieldValue(FHorizontalGroupByDefs.Get(k).FieldName, i, tmpValue);
        tmpKeyValue := GetIndexKeyValue(tmpValue, FHorizontalGroupByDefs.Get(k));
        if not FHorizontalValues[k].Contains(tmpKeyValue) then
          FHorizontalValues[k].AddValue(tmpKeyValue);
        currentCoord.Values[k] := tmpKeyValue;
      end;
    end;
  
  (*
    recCount := FVirtualDataset.DatasetDataProvider.GetRecordCount;
    if FVerticalGroupByDefs.Count > 0 then
    begin
      for i := 0 to recCount - 1 do
        CalculateSubIndex(FIndex, i, 0);
    end;
    *)
  end;
  
  { TmCalculationDefs }
  