tfrxDBCrossView total porcentage

pacoescribapacoescriba Spain
edited 10:36PM 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 10:36PM
    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 10:36PM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.