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)

X++ list of Maps

(1) ShareShare
ReportReport
Posted on by 4,079

I am going to be reading some data from a file, and I would like to make a method that reads all the lines from the file and saves them in a variable to return from the method.

The problem is that each line in the file might not have the same fields every time, but it does contain [FieldName, Value]

So I have used a Map to hold one line from the file at a time, and that works.

But now my problem is, where should I store all the Map variables per line that I get?

Anyone have an idea?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rudi Hansen Profile Picture
    4,079 on at

    Typical, a short time sending the question here, I find the solution.

    I was trying to save the Map in a List but since I was using a List of Types::AnyType it did not work, but with a List of Types::Class it worked.

  • Verified answer
    jasman Profile Picture
    1,413 on at

    Use the Array foundation class.

    static void Job186(Args _args)

    {

       Array oArray = new Array (Types::Class);

       Map   iMap = new Map(Types::Integer,Types::String);

       Map   getmap;

       MapEnumerator   gmE;

       iMap.insert(1,"Hest");

       iMap.insert(2,"Fest");

       iMap.insert(3,"Pest");

       oArray.value(1,iMap);

       iMap = new Map(Types::Integer,Types::Date);

       iMap.insert(1,18\01\1971);

       iMap.insert(2,24\12\2015);

       iMap.insert(3,01\06\2015);

       oArray.value(2,iMap);

       getMap = oArray.value(1);    

       gmE = getmap.getEnumerator();

       gmE.moveNext();

       gmE.moveNext();

       print gmE.currentValue();

       getMap = oArray.value(2);    

       gmE = getmap.getEnumerator();

       gmE.moveNext();

       gmE.moveNext();

       gmE.moveNext();

       print gmE.currentValue();

       pause;    

    }

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 March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans