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

Notifications

Announcements

No record found.

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!

I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans