Announcements
Hi experts,
Might come across as an easy question yet haven't found the answer anywhere yet:
Is there a way to initialise a string variable in code with a fixed length of characters for example initialise the variable _test with a fixed length of 10 characters?
`str _test(10);`
Kind regards
You can use str 10 _test, but I can't say whether it'll solve your problem, because you didn't explain what you're trying to achieve.
If you want to make sure that a string contains just ten characters, subStr() is likely the right approach.
By the way, you can read a bit more about str data type in AX documentation: Data Types in X++ > Primitive Data Types > Strings.
André Arnaud de Cal...
293,296
Super User 2025 Season 1
Martin Dráb
232,093
Most Valuable Professional
nmaenpaa
101,156
Moderator