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 10:35PM
    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 10:35PM
    Its very simple check screen shot below

  • edited 10:35PM
    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 10:35PM
    1732 views in 30 minutes! How do you do that ? >

Leave a Comment