Using FormatFloat in script

I am trying to print a currency formatted value to a TfrxMemoView on the report with the following script:
procedure txCreditLimitOnBeforePrint(Sender: TfrxComponent);
begin
  if <TRAN."CREDITAPPROVED"> = 1 then                                
    txCreditLimit.Text := 'Credit Limit: ' + FormatFloat('%2.2m', <TRAN."CREDITLIMIT">)
  else
    txCreditLimit.Text := '';                                                                   
end;

But all that I get out is %2.2m instead of the actual value. What am I doing wrong?

Comments

  • gpigpi
    edited 9:44PM
    Use Format function

    procedure txCreditLimitOnBeforePrint(Sender: TfrxComponent);
    begin
    if <TRAN."CREDITAPPROVED"> = 1 then
    txCreditLimit.Text := 'Credit Limit: ' + Format('%2.2m', [<TRAN."CREDITLIMIT">])
    else
    txCreditLimit.Text := '';
    end;
  • edited January 2015
    gpi wrote: »
    Use Format function

    procedure txCreditLimitOnBeforePrint(Sender: TfrxComponent);
    begin
    if <TRAN."CREDITAPPROVED"> = 1 then
    txCreditLimit.Text := 'Credit Limit: ' + Format('%2.2m', [<TRAN."CREDITLIMIT">])
    else
    txCreditLimit.Text := '';
    end;

    Ahhh! Ok... I thought that the Format function would only take a string as input? Thanks!

    As an aside, what do the different brackets (ie: [] and <>) signify? They get used in different combinations in different places and I haven't quite figured out the logic behind them.
  • gpigpi
    edited 9:44PM
    [] used as expression delimiters in the TfrxMemoView, TfrxRichView
    <> used as variables, fields delimiters in the script and expressions

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.