jecm254
18th January 2013, 00:06
Using the Baan session Maintain Query Data I am trying to create a query that will print only the first Production Planning record (table tisfc010) with Count Point "Yes" (tisfc010.copo = tcyesno.yes).
I have no experience using the Group By function, although the help text states that it can be used to eliminate duplicates.
I thought perhaps using order by tisfc010.pdno, tisfc010.opno desc and group by tisfc010.pdno, tisfc010.copo that it would do the trick, but I keep getting errors.

Can someone shed some light on how I can accomplish this? We have no programmer in house to create a "proper" report session for this.

The complete query is attached.

mark_h
21st January 2013, 15:32
What I would do is just select all the records for tisfc001 in the query itself. Then I would go into the report script and put in the detail before layout section a query for tisfc010. You would pull in the query tisfc001.mitm, tisfc001.pndo and then put something like in the report. Of course keep in mind you don't want to keep generating the report.

select tisfc010.*
from tisfc010
where tisfc010._index1 = {:tisfc001.pdno}
and tisfc010._copo = tcyesno.yes
order by tisfc010.opno | I would use desc if I wanted the last count point
as set with 1 rows
selectdo
selectempty
lattr.print = false | Skip those without a count point
endselect