Question Status

Suggested Answer
Mike Land asked a question on 22 Mar 2013 7:03 AM

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


Reply
Martin Dráb responded on 22 Mar 2013 8:05 AM

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

Reply
Mike Land responded on 22 Mar 2013 9:41 AM

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

What are other approaches, anyone know?

Mike

Reply
Martin Dráb responded on 22 Mar 2013 10:41 AM

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

Reply
Suggested Answer
Mike Land responded on 25 Mar 2013 7:50 AM

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

Thanks

Reply
Suggested Answer
Mike Land responded on 25 Mar 2013 7:50 AM

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

Thanks

Reply