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 :
Small and medium business | Business Central, N...
Answered

Multidimensional arrays in AL

(0) ShareShare
ReportReport
Posted on by 61

I was looking at the Arrays and List documentation, wandering whether it is possible to create multidimensional arrays with AL language - https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/list/list-data-type

It seems that this option is not available, and it is impossible to create neither List of Lists, not Array of Arrays, because only primitives are accepted.

My questions are:

1) what do I need to do in order to return n-dimensional array from procedure

2) why such a common feature is not supported in the AL-language?

I have the same question (0)
  • Suggested answer
    Andy Sather Profile Picture
    on at

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

  • Johny Be Good Profile Picture
    61 on at

    Hello, Andy! Thank you for the response. I wouldn't say that I need a support, I just curious why such a functionality wasn't implemented.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    Have you looked at this ?

    docs.microsoft.com/.../devenv-array-methods

  • Suggested answer
    YUN ZHU Profile Picture
    95,311 Super User 2025 Season 2 on at

    Hi, just adding Inge's reply, there are three types of Collection in Business Central: Array, Dictionary, List.

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/dictionary/dictionary-data-type

    pastedimage1653262134021v1.png

    Hope this helps.

    Thanks.

    ZHU

  • Johny Be Good Profile Picture
    61 on at

    Inge, thank you for response! Yes, I saw this article, and tried to create an array according to it:

       trigger OnRun();

       var

           arr: Array [2] of Integer;

       begin

           arr[1][1] := 10;

       end;

    But editor failed, when set the value with the following error:

    Cannot apply indexing with [] to an expression of type 'Integer'

  • Johny Be Good Profile Picture
    61 on at

    Yun Zhu, thanks for your reply! I saw the documentation, I think the problem is the lack of examples how to work with those collections. I haven't found examples how to work with multi-dimensional arrays, and I have an error trying to add new value

  • Verified answer
    YUN ZHU Profile Picture
    95,311 Super User 2025 Season 2 on at

    Hi, try the following.

    pastedimage1653520400624v1.png

  • Johny Be Good Profile Picture
    61 on at

    That's what I needed! Thanks a lot Yun Zhu for your help!

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,316

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,449 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,431 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans