Notifications
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 664 Most Valuable Professional
André Arnaud de Cal... 522 Super User 2025 Season 2
Sohaib Cheema 303 User Group Leader