Joy Conner
8th February 2003, 00:05
We have a need to store the packing List date. I have added a field the the tdsls045 table and I have modified the packing report script as follows.....

detail.20:
before.layout:
if printed = tcyesno.no then
| This is an original print of the packing list.
db.retry.point()
select tdsls045.*
from tdsls045 for update
where tdsls045._index1 = {:tdsls045.orno}
selectdo
new packing list field = date.num()
db.update(tdsls045, db.retry)
commit.transaction()
endselect
endif

Is there a problem with this approach? Is it OK to update a field in a report script?

Thanks in advance - Joy

lbencic
8th February 2003, 00:33
This can be done and obviously, the update works. However, last I heard (admittadly several years ago) Baan does not recommend putting updates in report script for a couple reasons.
1. The program script may run through, but fail at the end before the report close, so the reports are never printed. This leaves a mismatch between records that have been processed through program script, but not processed through report script.

2. Reports can be reprinted. The one you have has a reprint yes/no option on it, as most print sessions that also update should. But if the report gets killed due to a paper jam or other reason after the report script is executed, and is reexecuted by the user via the print que...i think it may reexecute.

I think those are the reasons...I know that when I very first started in Baan we did some updates in the report script, and the customer had bad results because the reports were being queued and not printed until later, and there was a mismatch. Maybe some of this has been fixed since then.

tjbyfield
8th February 2003, 00:52
In addition to the specific points made by Ibencic.

The approach we have taken when extra fields are required is to add ne table with the required fields rather than change the Baan table definitions. Our rationale for this is that we can still apply baan solutions and any future upgrades easily and all our changes to tables are contained in separate tables.

Following Ibencic's points, if you do need to update a field it would be better to do it in the program that updates the packing slip number in tdsls045 and then calls the print program. For IVc this would probalby be tdsls4403. If you were to add a table that contained only the packing slip date (perhaps the packing slip number for an index) and the tdsls045 key fileds it would be quite a small table and not cause you much storage or processing overhead. the update of this table would be committed with the commit for the update of tdsls045.

On another theme. Are you sure that you cannot get the date some other way. When is the packing slip produced? Is just after the outbound is released ? (if using ILC) If so you should be able to get the date from the tdilc301 record via tdsls045/tdilc401. If not using ILC then you may be able to get it from tdinv700.

Just some thoughts

Terry