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)

Custom number format please help

(0) ShareShare
ReportReport
Posted on by

Hello, i'm trying to create a template for my company and I got stuck on one thing:

My company uses the following number format example: 123 987 456.00. The thing i want to make is this: 

In c/al code -BodyLineText[6]:= STRSUBSTNO('%1', FORMAT(XXXXXXXXXXXXXXX ,0,'### ### ##.00')); I tried looking on how to make this work, but with no luck, the default formats like 

  • <Sign><Integer Thousand><Decimals> is Format 0

  • <Sign><Integer><Decimals> is Format 1

  • <Sign><Integer><Decimals><1000Character,.> is Format 2

  • <Integer Thousand><Decimals><Sign,1> is Format 3

  • <Integer><Decimals><Sign,1> is Format 4

is not good enough for my company. The if I replace the '### ### ##.00' with the formats mentioned above example: BodyLineText[6]:= STRSUBSTNO('%1', FORMAT(XXXXXXXXXXXXXXX ,0,0)); it works perfectly, but the format is not what i need. I know that i can do it much simplier in visual studio if i change the BodyLineText from text into decimal, but thats not what i want to make. Is the format what i want to make even possible to do? Maybe someone could help me.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hi,

    I am not sure how you want to make it look like at the end. Is it the spaces between the numbers?

    Maybe this custom function will help you.

    Replace(String : Text;FindWhat : Text;ReplaceWith : Text) NewString : Text
    WHILE STRPOS(String,FindWhat) > 0 DO BEGIN
      String := DELSTR(String,STRPOS(String,FindWhat)) + ReplaceWith + COPYSTR(String,STRPOS(String,FindWhat) + STRLEN(FindWhat));
    END;
    NewString := String;
    Var                       Name                   DataType            Subtype              Length
    No                        String                   Text                                                 
    No                        FindWhat            Text                                                 

    No                        ReplaceWith      Text

    Then you can replace the spaces in the text.

  • Community Member Profile Picture
    on at

    Yes my goal is to make spaces as a thousand separator.

  • Verified answer
    Binesh Profile Picture
    7,885 on at

    Hello,

    Christopher007 solution is working, 

    //you have to call your Decimal Variable with FORMAT so format inserted comma after every 3 digits

    DecimalVariable := 123456789.12;
    MESSAGE('%1',Replace(FORMAT(DecimalVariable),',',' '));

  • Community Member Profile Picture
    on at

    Thank you Binesh Singh Rajput and Christopher007

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