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);
}

Leave a comment