AX 2009: How to return data in collection read from DB in Report's executeSection method

This question has suggested answer(s)

Hello,

I have to read data from Database in my MorphX based report and then return it in Collection (multiple rows).

There is element..send method in method executeSection but how to return collection of e.g. Table objects back to Report with it?

I have a code snippet that I tried to do it.

public void executeSection()
{
ProdBOM pbom;
ProdRoute prRoute;
RecordSortedList recordSortedList = new RecordSortedList(tablenum(ProdBOM));
ProdBOM pbomtable;
ReportControl control;
int i;
;

i = 0;

while select pbom
join prRoute
where (pbom.OprNum == prRoute.OprNum && pbom.prodId == prRoute.prodId)
{
if(i > 0) // Not first one!
{
recordSortedList.ins(pbom);
}
else
{
i++;
}
}

element.send( how to convert recordSortedList into ProdBOM list???? );

Best Regards,

Mike


All Replies
  • send() accepts a value of Common type, so there is no way how to pass RecordSortedList into it. Either iterate your collection and send each record individually, or use some other approach.

    Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

  • Sending each item seems to override previous one in the loop,

    What are other approaches, anyone know?

    Mike

  • If send() doesn't do what you expect, you probably call it from a wrong place.

    Another approach? You could save data to temporary table and use it as normal datasouce, for example.

    Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

  • In loop after each .send call calling super() helped!

    Thanks