Using a str datatype in x++ is not like using this datatype in any other language.
You can use a string variable by using the type str or an extended data type.
A string can defined with a fixed size and with an adjustment left or right.
But where is the difference? What is possible?
Without a fixed length the variable is a memo.
![]()

Using this type as a tablefield, the database uses the type ntext.
How many chars can be stored in this variable? It depends on your memory!
How many chars can be stored in the tablefield? Up to 2^31 chars!
But you can’t use this tablefield in an index and you can’t search inside this field!
But be careful, the memo-type is used “by value”. Every use as parameter in a functioncall will need the same memory again!
You can test it:

TestProject.xpo
Using the str type with a fixed size, defined at x++ code, the compile accepts almost every size !
So you can define a

But at runtime you can only use max. 1000 chars!!
When you define an extended data type with a size of 5000 chars,
you can use the whole size! The maximum size of an extended data type is 32767.
Here is a test-job:

TestProject.xpo
But when you use this extended data type for a tablefield, the database can only manage a fieldsize of 4000 char (older versions of ax don’t use unicode, so the database use varchar instead of nvarchar and so 8000 chars can be used).
Using an str with a fixed size can adjusted left or right. But be careful, adjustment right fields slows your system down, because the fields will be trimmed each time they are “read” from database.
(take a look at the aos-server-config / database settings, bottom)
![]()
RSS
LinkedIn
Twitter
Xing
Recent Comments