Thursday 4 July 2013

Record Link List in Ax 2012


Hi Friends,

We have RecordLinkList which is used to store buffers of different tables in one go.

Here below is the example of how to use Record Lint List.



RecordLinkList recordLinkList;
;
recordLinkList = new RecordLinkList();

for (buffer = McsEmValConsumptionValidationView_DS.getFirst(true) ? McsEmValConsumptionValidationView_DS.getFirst(true) : McsEmValConsumptionValidationView_DS.cursor(); buffer; buffer = McsEmValConsumptionValidationView_DS.getnext())
{
if (buffer.CalculatedConsumptionValidUntilDate == FcsDateTimeAPI::DateNull())
{
recordLinkList.ins(buffer);
}
}

while retrieving you can use this

hasNext = recordLinkList.first();
while (hasNext)
{
common = recordLinkList.peek();
switch (common.TableId)
{
case tableNum(McsEmValConsumptionValidationView):
consValView = common;
calculatedConsumption = McsEmCalcCalculatedConsumption::find(consValView.CalculatedConsumptionId);
break;

case tableNum(McsEmValProcessErrorDetailInfo):
processErrorDetailInfo = common;
calculatedConsumption = McsEmCalcCalculatedConsumption::find(processErrorDetailInfo.CalculatedConsumptionId);
break;

default:
hasNext = recordLinkList.next();
continue;
}

Vivek Chirumamilla