Ref: format value in cross-tab
Hello, excuse me for my English, I am Brazilian.
Well, I made a cross-tab in the following way:
DIST?NCIA
TAXAS
(KM)
At? 10 Kg
At? 50 Kg
At? 75 Kg
At? 100 Kg
Acima 100 Kg
Valor Frete
0005
10
14
18
25
0,131
0,5
0010
11
15
19
27
0,152
0,6
0045
12
16
20
28
0,155
0,7
0060
13
17
21
29
0,18
0,8
0100
14
18
22
30
0,195
1
implementation
var
ValorExcedente: String;
{$R *.dfm}
procedure TForm1.ppCrossTabGetCaptionText(Sender: TObject;
aElement: TppElement; aColumn, aRow: Integer;
const aDisplayFormat: String; aValue: Variant; var aText: String);
begin
/ / formata the values of the table
if (aColumn = 0) and (aRow = 0) then
aText := 'DIST?NCIA'
else if (aColumn = 1) and (aRow = 0) then
aText := 'TAXAS'
else if (aColumn = 0) and (aRow > 1) then
aText := FormatFloat('0000',aValue)
else if (aColumn = 0) and (aRow = 1) then
aText := '(KM)'
else if (aColumn > 0) and (aRow = 1) then begin
if (aValue <> '8888') and (aValue <> '9999') then begin
ValorExcedente := aText;
aText := 'At? '+aText+' Kg';
end
else if aValue = '8888' then
aText := 'Acima '+ValorExcedente+' Kg'
else if aValue = '9999' then
aText := 'Valor Frete'
end;
end;
I would like to know as that I do for formatar all the columns for decimal
(#,0.00;-#,0.00), except the with I title it "Above 100 Kg", where I want
formatar for three houses decimal (#,0.000;-#,0.000).
He/she notices: Delphi 6 service pack 2, with ReportBuilder Ent. 7.01.
Thank you,
Ivan.
ICQ#: 91313329
Well, I made a cross-tab in the following way:
DIST?NCIA
TAXAS
(KM)
At? 10 Kg
At? 50 Kg
At? 75 Kg
At? 100 Kg
Acima 100 Kg
Valor Frete
0005
10
14
18
25
0,131
0,5
0010
11
15
19
27
0,152
0,6
0045
12
16
20
28
0,155
0,7
0060
13
17
21
29
0,18
0,8
0100
14
18
22
30
0,195
1
implementation
var
ValorExcedente: String;
{$R *.dfm}
procedure TForm1.ppCrossTabGetCaptionText(Sender: TObject;
aElement: TppElement; aColumn, aRow: Integer;
const aDisplayFormat: String; aValue: Variant; var aText: String);
begin
/ / formata the values of the table
if (aColumn = 0) and (aRow = 0) then
aText := 'DIST?NCIA'
else if (aColumn = 1) and (aRow = 0) then
aText := 'TAXAS'
else if (aColumn = 0) and (aRow > 1) then
aText := FormatFloat('0000',aValue)
else if (aColumn = 0) and (aRow = 1) then
aText := '(KM)'
else if (aColumn > 0) and (aRow = 1) then begin
if (aValue <> '8888') and (aValue <> '9999') then begin
ValorExcedente := aText;
aText := 'At? '+aText+' Kg';
end
else if aValue = '8888' then
aText := 'Acima '+ValorExcedente+' Kg'
else if aValue = '9999' then
aText := 'Valor Frete'
end;
end;
I would like to know as that I do for formatar all the columns for decimal
(#,0.00;-#,0.00), except the with I title it "Above 100 Kg", where I want
formatar for three houses decimal (#,0.000;-#,0.000).
He/she notices: Delphi 6 service pack 2, with ReportBuilder Ent. 7.01.
Thank you,
Ivan.
ICQ#: 91313329
This discussion has been closed.
Comments
It is possible to customize the display format of each cell in two ways.
First you can change the display format manually by right clicking over the
cell value and selecting the "Display Format" option in the pop-up menu.
Second you can access the display format of individual cells by using the
OnFormatCell event and adjusting the aElement.DisplayFormat property.
See the ReportBuilder Reference Guide Pg. 349 for an example of how to
create and format a CrossTab component.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com