web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Johny Be Good Profile Picture
    61 on at
    RE: Multidimensional arrays in AL

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

  • Verified answer
    YUN ZHU Profile Picture
    92,443 Super User 2025 Season 2 on at
    RE: Multidimensional arrays in AL

    Hi, try the following.

    pastedimage1653520400624v1.png

  • Johny Be Good Profile Picture
    61 on at
    RE: Multidimensional arrays in AL

    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

  • Johny Be Good Profile Picture
    61 on at
    RE: Multidimensional arrays in AL

    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'

  • Suggested answer
    YUN ZHU Profile Picture
    92,443 Super User 2025 Season 2 on at
    RE: Multidimensional arrays in AL

    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

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,041 Moderator on at
    RE: Multidimensional arrays in AL

    Have you looked at this ?

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

  • Johny Be Good Profile Picture
    61 on at
    RE: Multidimensional arrays in AL

    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
    Andy Sather Profile Picture
    on at
    RE: Multidimensional arrays in AL

    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.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,132

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 3,615

#3
Sumit Singh Profile Picture

Sumit Singh 2,912

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans