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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

num2str culture settings

(0) ShareShare
ReportReport
Posted on by 85

Hi, 
I have several API methods which are using 

num2str(num,0,2,0,0)))

as number to string conversion. It worked fine in 2009 returning proper locale settings based
on windows settings, but in D365 does it does not seem to be the case. When I currently use
it . (dot) as separator is returned. If I change 0 to 99 then , (coma) as separator is returned. 

Now the question is - from where exactly locale settings are taken from to do the conversion?
I've tried user setting and local server settings, but it didn't change the result. 

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: num2str culture settings

    Hi,

    by looking at the documentation, I don't think that 0 is a supported value for decimal separator. I'm not sure what settings the Auto option is using, I would assume it uses the settings of the current user. Just like the number formatting on all D365 forms uses the user's settings to format the values.

    You can provide 1, 2 or 99 as the decimal separator option, but 0 is not one of the supported values. 99 means Auto, 1 means Dot and 2 means Comma.

    Thousand separator has a bit more options, but you can find them all in AOT under System documentation -> Base enums -> ThousandSeparator (the decimal separator is using DecimalSeparator enum).

    docs.microsoft.com/.../xpp-conversion-run-time-functions

  • luksz Profile Picture
    85 on at
    RE: num2str culture settings

    Hi Nikolaos,

    User settings work fine for the GUI, but it seems that not that good for the APIs. I have Azure app running on user with DA number format (which uses , as separator), I've changed num2str so 99 are now used. API returns values with coma. If I change settings on that user to en-US still coma is returned as separator. What am I missing?

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: num2str culture settings

    I don't know, but I think you should just specify what you want and not trust "Auto" in integrations.

    Can we solve your business requirement by specifically telling the function what kind of format we want?

  • luksz Profile Picture
    85 on at
    RE: num2str culture settings

    We're in EU, so coma is used for our customers, at least for now. I was simply wondering if it's possible to have it more flexible if UK customer would appear one day.

  • Suggested answer
    ergun sahin Profile Picture
    8,824 Moderator on at
    RE: num2str culture settings

    Instead of using num2str directly, you can open a field in the parameter tables, add a method to the global and manage the situation

    Or you can import the value from outside instead of using constant value(1/2)

  • Verified answer
    luksz Profile Picture
    85 on at
    RE: num2str culture settings

    This is exactly what we are going to do - add additional parameter to have control over conversion.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,004

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 857 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 548 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans