web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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
    304,708 Super User 2026 Season 1 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
    Microsoft Employee 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
    239,451 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans