web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

System.Format() for leading zeroes

(0) ShareShare
ReportReport
Posted on by 41

Hi everyone!

I'm trying to write a function that will take values from a table and write them to a plain text file.

In order to make the text easier to read, I'm trying to get the values in some of the columns to all be the same length. I want to achieve this by using leading zeroes.

So, let's say I want all the values to be five characters in length. If the value in the column was 99, it would be written as 00099. If it was 999, it would be written as 00999.

I understand the function System.Format() can help me achieve this, but unfortunately I haven't been able to figure out how. Does anyone know what value I have to give in the Format parameter in order to achieve this kind of result? Or maybe an alternate solution altogether?

Thanks for your time!

  • Verified answer
    YUN ZHU Profile Picture
    103,672 Super User 2026 Season 2 on at

    Hi, here are two great examples that hopefully give you some hints.

    (99+) how to format quantity - Dynamics 365 Business Central Forum Community Forum

    Thanks

    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 753 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 583 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 302 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans