tfrxDBCrossView total porcentage

pacoescribapacoescriba Spain
edited 2:26AM in FastReport 3.0
I want calculate the subtotal in a TfrxDBCrossView, but i want see as porcentage of the total. Is it possible? Thanks

Comments

  • pacoescribapacoescriba Spain
    edited 2:26AM
    Ok. I could do it!

    I have TWO tfrxCrossView components. In the first, i calculate as usual. I use the next code

    I copy the value of the TOTAL of the first component in an array, and next, i calculate the new values before print the second component...

    Ok, it's a dirty hack, but it's functional !

    var
    temporal : array [0..6] of integer;
    TOTAL : integer;
    cuenta : integer;
    cuenta2 : integer;
    FilaFinal :integer;
    ColumnaInicial:Integer;



    procedure DBCross3OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
    begin


    if DBCross3.IsGrandTotalRow(RowIndex) then
    if DBCross3.IsGrandTotalColumn (ColumnIndex) then
    TOTAL :=StrToInt(trim( Memo.Text))
    else
    begin
    temporal[cuenta] := StrToInt( trim(Memo.Text));
    inc(cuenta);
    end;
    end;


    procedure DBCross2OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
    begin
    if DBCross3.IsGrandTotalRow(RowIndex) then
    if DBCross3.IsGrandTotalColumn (ColumnIndex) then
    // TOTAL :=StrToInt(trim( Memo.Text))
    else
    begin
    Memo.Text := FloatToStr(round(10000* temporal[cuenta2]/TOTAL)/100)+'%';
    inc(cuenta2);
    end;


    end;
  • edited 2:26AM
    I'm not sure if my solutions will work with FR3, but you may take an idea of what I did while testing similar problems with FR4 DBCross.
    Here you have some links to other topics:

    [topic="7162"] DBCross - how to make an additional summary row?[/topic]
    [topic="7711"] Group Footer with multple aggregate rows [/topic]
    [topic="7722"] StdDev Aggregate [/topic]
    [topic="7726"] StartNewPage has No Effect [/topic]

    Mick

Leave a Comment