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 :
Microsoft Dynamics NAV (Archived)

Removing leading zeros

(0) ShareShare
ReportReport
Posted on by 779

Hi, I'm exporting a group of a decimal fields to txt and I'm getting those fields with leading zeros: 000000246 and the result I pretend is 246.
I did this funtion below and tried the same function with the parameters on DELCHAR and it didnt work.
Any tip?

DecimalNumeralZeroFormat(Amount,9)

//Respective Function

LOCAL DecimalNumeralZeroFormat(DecimalNumeral : Decimal;Length : Integer) : Text[250]
EXIT(TextZeroFormat(DELCHR(FORMAT(ROUND(ABS(DecimalNumeral),1,'<'),0,1)),Length));


*This post is locked for comments

I have the same question (0)
  • Mohana Yadav Profile Picture
    61,170 Super User 2026 Season 1 on at

    What code do you have in TextZeroFormat function?

  • Martinho Costa Profile Picture
    779 on at
    LOCAL TextZeroFormat(Text : Text[250];Length : Integer) : Text[250]
    IF STRLEN(Text) > Length THEN
      ERROR(Text003,Text,Length);
    EXIT(PADSTR('',Length - STRLEN(Text),'0') + Text);

  • Natalie Karolak - the BC Docs Librarian Profile Picture
    1,955 on at

    I am unsure whether I got the point ...

    What is your desired output, and what are you getting instead?

  • Verified answer
    Mohana Yadav Profile Picture
    61,170 Super User 2026 Season 1 on at

    TextZeroFormat function is adding the leading zeros.

    Please try to change your code by removing above function

  • Natalie Karolak - the BC Docs Librarian Profile Picture
    1,955 on at

    Then replace the function call with FORMAT(Amount);

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    hi,

    follow msdn.microsoft.com/.../dd354973.aspx for delchr function 

    and http://msdn.microsoft.com/en-us/library/dd301101.aspx for padstr function.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans