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 :
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,005 Super User 2025 Season 2 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,005 Super User 2025 Season 2 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

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

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans