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 :
Microsoft Dynamics AX (Archived)
Unanswered

dynamic string array length

(0) ShareShare
ReportReport
Posted on by 535

I know dimOf only can be used with primitive values, so what can I use to get the length of a string array to make this dynamic?

for (i = 0; i <= dimOf(ClockNums); i++) {

switch (_Activity) {

case 'Add': Valid ="ADD"; break;

case 'Delete': Valid ="DELETE"; break;

case 'Update': Valid ="UPDATE"; break; }

}

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi KeithM,

    Can you please elaborate? What is it exactly what you want to achieve? Can you provide some background on the process?

  • Blue Wang Profile Picture
    on at

    Hi KeithM,

    Yes.

    The dimOf function is intended for X++ arrays that are declared as the following X++ primitive types: Boolean, date, int, int64, real, utcDateTime.

    https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-ref/xpp-reflection-run-time-functions#dimof

    You can  use Array to replace your dynamic array ,and then use lastIndex()  to get length of array.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    It's hard to guess what you want, because your description is vague and your code doesn't make sense.

    Note that string is a primitive type in X++.

    If you want "a dynamic array", maybe you shouldn't use an array at all. There are other collection classes available, such as List and Set.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans