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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How long is the str?

(0) ShareShare
ReportReport
Posted on by 1,965

Hi,

When we define a variable str text;

How many characters can this text field contain?

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    You can think of is as unlimited. It accepts more than you should ever put in it, becuase you would be wasting a huge amount of RAM.

  • .. Profile Picture
    1,965 on at

    So it's better not to use it right ? It's better to create an EDT with a limited length

  • Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    It doesn't matter, as long as we're talking about a variable. The underlaying type is always System.String, whether you declare the type as str, str 20 or use an EDT.

    Therefore no, you can't say that using an EDT is better, because it doesn't make any difference for this scenario. If you're wasting resources by putting too much data to variables, don't believe that you can fix that by change the type in variable declaration. That's not the cause.

    Using EDTs may make your code easier to understand, but that's a different topic.

  • Suggested answer
    Florian Hopfner Profile Picture
    2,461 on at

    The documentation of the str primitive data type seems to hold the answer to the question:

    "A string can hold an unlimited number of characters, however, you can specify the maximum length of a string in the variable declaration. The string is then truncated to that maximum length."

    X++ primitive data types - str

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans