tfrxDBCrossView total porcentage
pacoescriba
Spain
I want calculate the subtotal in a TfrxDBCrossView, but i want see as porcentage of the total. Is it possible? Thanks
Comments
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;
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