RecordLinkList in Dynamics AX [X++]

In this post, I am going to explain RecordLinkList class which will help the developer to dynamically create a cache of record-buffers. A recordLinkList works as a double linked list that can hold records of different tablebuffers at the same time.

The recordLinkList is particularly useful for passing records from different tables as a parameter instead of retrieving the same records again.

There is no size limit of a recordSortedList, developer can control its size and its memory consumption

static void SR_RecordLinkListExample(Args _args)
{
RecordLinkList rll;
CustTable custTable;
VendTable vendTable;
EmplTable emplTable;

boolean toIterate;
;
rll = new recordLinkList();

select firstonly custTable;
select firstonly vendTable;
select firstonly emplTable;

rll.ins(custTable);
rll.ins(vendTable);
rll.ins(emplTable);

toIterate = rll.first();

custTable = null;
vendTable = null;
emplTable = null;

while (toIterate)
{
switch(rll.fileId())
{
case tablenum(custTable): custTable = rll.peek(); break;
case tablenum(vendTable): vendTable = rll.peek(); break;
case tablenum(emplTable): emplTable = rll.peek(); break;
}
toIterate = rll.next();
}

info (custTable.AccountNum +’,’ + vendTable.AccountNum + ‘,’ + emplTable.emplId);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: