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, ...
Answered

How length of variable is interpreted in visual studio CIL

(0) ShareShare
ReportReport
Posted on by 10

Hi,

I have an case, where an AIF service is consumed and the variable length is 20.

Through code i am concatenating two values, and assigning to a variable with length 20. 

Consider an scenario, where the concatenation exceeds the length of 20. Ax is smart enough to truncate the values to length to 20.

But when AIF service is consuming the code, the length is not truncate the value. Tried debugging through Visual studio and found the variable does not have any length restriction on visual studio code. 

Anyone experienced something similar. If so, could someone explain what is different and how to avoid this issue.

Highly appreciate any thoughts on this behavior. Thanks in advance. 

I have the same question (0)
  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Have you tried using a temp variable (System.String etc.)?

  • Verified answer
    Martin Dráb Profile Picture
    237,884 Most Valuable Professional on at

    Assuming that youre taling about strings, what you see is the documented behavior. Let me quote the documentation:

    The System.String type in .NET Framework does not have a property that corresponds to the maximum length of an X++ str, and string truncation does not occur.

    You can use functions like subStr() to take first 20 characters from a string.

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 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans