Topic: Formatting a calculated field on a data grid
How can I format a calculated database field on a data grid so that it shows 2 decimal places eg 99.99 rather than 99?
My Visual Database → General → Formatting a calculated field on a data grid
How can I format a calculated database field on a data grid so that it shows 2 decimal places eg 99.99 rather than 99?
Try this:
printf('%.2lf', fieldname)
Problem solved, many thanks.
Is it possible to right align using the printf command?
You can do it using a script, example:
procedure Form1_TableGrid1_OnChange (Sender: string);
begin
Form1.TableGrid1.Columns[0].Alignment := taRightJustify; // first column
Form1.TableGrid1.Columns[1].Alignment := taCenter;
Form1.TableGrid1.Columns[2].Alignment := taLeftJustify;
end;
How can I add the decimal places to a "sum" in the footer?
How can I add the decimal places to a "sum" in the footer?
You can do it using script, example:
procedure Form1_TableGrid1_OnChange (Sender: string);
begin
Form1.TableGrid1.Columns[3].Footer.Caption := FormatFloat('0.00', Form1.TableGrid1.Columns[3].Footer.FormulaValue)
end;
also you can download project with example
Thanks - All working
My Visual Database → General → Formatting a calculated field on a data grid
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi