Announcements
No record found.
Hi,
When we define a variable str text;
How many characters can this text field contain?
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.
So it's better not to use it right ? It's better to create an EDT with a limited length
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.
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 659
André Arnaud de Cal... 465 Super User 2026 Season 1
Syed Haris Shah 304 Super User 2026 Season 1