day number to be three digits wide

TrippyZ
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?
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
0
Comments
-
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.0 -
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.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions