David A. Green
18th February 2002, 18:03
Phantoms parts do not get printed on the Materials List report (tisfc04080400). The reason for this is because phantoms are not added to the Estimated & Actual Materials table (ticst001) when the Estimated BOM is created.

My company requires first-level phantoms to appear on the Materials List report, and we could have as many as six phantoms per BOM. They're happy for the phantoms to appear on the header (or footer) of the report.

I've found a solution of sorts by adding six new header layouts and writing a report script for each of the layouts:

header.4:
before.layout:
select tibom010.mitm
from tibom010
where tibom010._index1={:tisfc001.mitm} and tibom010.cpha=1
as set with 1 rows
selectdo
endselect

This picks up the first phantoms from the P-BOM.

In header.5 I specify as set with 2 rows. This picks up the second phantom. And so on.

This works okay, although the problem I'm having is that if there are (say) only 2 phantoms, then the last phantom gets repeated on the third, fourth, fifth and sixth header layouts.

I can't help feeling there is a smarter, more elegant way to achieve this result without duplication of phantoms. Any ideas?

Thanks in advance for your help.

evesely
18th February 2002, 21:14
Try something like this:


declaration:
domain tcpono last.pono

header.3:
before.layout:
last.pono = 0
lattr.print = false

header.4:
before.layout:
select tibom010.sitm, tibom010.pono
from tibom010
where tibom010._index1={:tisfc001.mitm} and tibom010.cpha=1
and tibom010.pono > {:last.pono}
as set with 1 rows
selectdo
last.pono = tibom010.pono
selectempty
lattr.print = false
endselect

after.layout:
layout.again()

This way, only header.4 would have to be set up for printing your phantoms.

You could do this in the footer or (with a minor change) in before.field layouts as well.

David A. Green
19th February 2002, 18:12
Thanks for your quick reply, Ed.

I tried your code this morning, and I received "Type mismatch: combined and uncombined " compilation errors. I think it's the last.pono = tibom010.pono line that is causing the problem.

Any ideas? Sorry to pester you with this....

evesely
19th February 2002, 19:13
You are absolutely right. Get rid of the curly braces around the :last.pono entry. So, that line should read:
and tibom010.pono > :last.pono

My apologies. I guess I got curly-brace happy.

David A. Green
20th February 2002, 10:27
That's excellent, Ed. Works a treat! I should have put my thinking head on and worked out that curly bracket bit for myself.

This has been my first post to the BaaNboard, and I must say I'm delighted with the outcome.

Thanks again for your help.