Leading Zeros

Hi all, is there any way to fotmat an integer like this? 1-> 0001

I've tried the function FormatMaskText whith the working EditMask string from Delphi but it didn't work. I didn't find any help about this FR function.

Can someone help me?

Tks!

Sergio

Comments

  • gpigpi
    edited 4:09PM
    Try 0000 format string
  • edited October 2013
    This works for me
    use this function, put it in your code
    function AddLeadingZeroes(const aNumber, Length : integer) : string;
    begin
    result := SysUtils.Format('%.*d', [Length, aNumber]) ;
    end;


    make a variable in fastreport and fill it in delphi
    make in the report the variable number
    put this text in the variable [number]
    in the frxreport1getvalue event type
    if CompareText(VarName, 'number') = 0 then
    value:= AddLeadingZeroes(-your number-,4);
  • edited 4:09PM
    Its very simple check screen shot below

  • edited 4:09PM
    S? wrote: »
    Hi all, is there any way to fotmat an integer like this? 1-> 0001

    I've tried the function FormatMaskText whith the working EditMask string from Delphi but it didn't work. I didn't find any help about this FR function.

    Can someone help me?

    Tks!

    Sergio

    Here is my solution
    Number Format with Leading Zeros
  • hsmhsm
    edited 4:09PM
    1732 views in 30 minutes! How do you do that ? >

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.