day number to be three digits wide

TrippyZTrippyZ Member Posts: 87
The following code returns an integer, I need to to be three digits wide when I write it to a text file, padded with leading zero;

WORKDATE-CALCDATE('<-CY>',WORKDATE)

So the above might return
1 to be 001
34 to be 034
345 to be 345

I can't seem to get the format command to do this so had a look at PADSTR but that pads as the end.


Any ideas?
Professional Navision Developer

Comments

  • matttraxmatttrax Member Posts: 2,309
    FORMAT returns a string, you just want to append another string to it.

    So '0' + MyDateAsaString

    FORMAT has a <Day,2> property you can look into as well.
  • jlandeenjlandeen Member Posts: 524
    If you can get the correct string for the numerical (i.e. non zero portion) of the string - you could just write a little function that left pads the string with leading zeros if required.

    I find having a left pad function is necessary with a lot of EDI transactions that have very exact data requirements in the character formats submitted.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
Sign In or Register to comment.