tap268
19th August 2003, 15:02
I generated a custom display session in Baan. The session is based on table tiitm001. However, we have a custom yesno field in this table. I want to display only the records where this field is equal to yes. I have tried removing the main table and writing a before.program, a before.display, a when.field.changes. What is the trick. There is nothing else in the script. Help.

evesely
19th August 2003, 15:28
Leave the main table and use a query extension. The syntax differs depending on whether you are using 4 or 5 (you might want to update your profile).

This thread (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=8967) is a good place to start.

tap268
19th August 2003, 18:55
This worked great. Many thanks. Now, ready for the second part? I want to display the corresponding records from a custom table based on the item code in tiitm001. I am trying to do this in the before.program also. Nothing blows up but no records display either. Any suggestions?

evesely
19th August 2003, 21:22
Create a before.display section for the first field from the other table. In that section, do a select on the other table. Example:


field.tcmcs003.cwar:
before.display:
select tcmcs003.*
from tcmcs003
where tcmcs003._index1 = {:tiitm001.cwar}
endselect


There are many different ways to accomplish this.

You might want to check out this link (http://www.baanboard.com/programmers_manual_baanerp_help_4gl_features_overview). It discusses the 4GL in more detail.

tap268
19th August 2003, 22:06
I did already tried this. I did it again to see if I had missed something the first time. Nothing blows up but nothing shows up either. I also tried it with and without display. As follows:


declaration:

table ttiitm001 | Items


before.program:

query.extension = "tiitm001.tifg.o <> tcyesno.no"

field.tiitm101.item.o:
before.display:
select tiitm101.*
from tiitm101
where tiitm101._index2 = {:tiitm001.item}
selectdo
display.all() *****ALSO TRIED WITHOUT
endselect

evesely
20th August 2003, 15:29
You should also declare table tiitm101 in the declaration section. I would have guessed that to be a compiile issue, however. I assume the fields on your form from the other table are tiitm101.item.o, tiitm101.xxxx, etc., right? Also, are the fields designated as "display" or "display only"? The former is more appropriate here, especially for field tiitm101.item.o on your form.

That's all I can think of at the moment. Good luck! :)

tap268
20th August 2003, 21:23
OK. Diligent attempts on your part to help, but still no luck. Is it because this (tiitm101) is a custom table? I have done this many times before and never had this much trouble. Could it be the start option? Tried refresh, find, first.set, etc. I think I am grabbing at straws now.

evesely
21st August 2003, 15:25
Try putting the script in debug mode and walking through it. You should be able to see which sections are executing and which ones you think should execute but don't.

tap268
22nd August 2003, 21:00
We have found the solution. I am forwarding it to you in case someone else experiences the same problem.

declaration:

table ttiitm001 | Items
table ttiitm101 | Item/Container
table ttcmcs003 | Warehouses

main.table.io:
after.read:
select tiitm001.tifg.o
from tiitm001
where tiitm001._index1 = {:tiitm101.item.o}
selectdo
endselect

*** after.read was the trick
Thanks for all of your help