Search code examples
fastreport

how to set value for the column grand total in fast report 4


I have a DB Cross-tab object enter image description here

enter image description here

i whant set value for column grand total for exampel : A+B-C-D-E-F-G-H-I = Grand ToTal

or Grand Total = Grand Total -A -B


Solution

  • Try to use cross' OnPrintCell event (Grand Total = Grand Total - A):

    procedure Cross1OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
    begin
      if ColumnIndex = 0 then
        if Value <> null then 
          Set('Var0', Value)
        else
          Set('Var0', 0);
      if Cross1.IsGrandTotalColumn(ColumnIndex) then Memo.Text := VarToStr(Value - Get('Var0'));
    end;