I have a requirement:
- We have a table called "Header" with a field "Header No." This is an Autoincrement Integer field.
- We have a table called "Lines", with a field called "Header No." with direct TableRelation to the Header table field.
Now the requirement is that when a new Header is created, we automatically have to create 4 Lines. The problem is that in the OnInsert() trigger of the Header table, we don't have the new Autoincrement value, so we can't fill the Header No. in the Lines.
We will use a Page to create every new header. ¿Any ideas on how we can get the AutoIncrement value, or achieve this with some workaround?
Thanks.
0
Comments
You can use the trigger of the page:
http://www.sist.biz/en/ [en] | http://www.sist.biz [de]
I've also auto-inserted purchase lines into these types of documents. The code can be done in the OnInsert trigger of the "Header" table in most cases, but sometimes needs to be done in the page OnInsert trigger. You have access to the Header's "No." field and thereby can put that reference in the "Line" or "Detail" records as well.
INSERT(TRUE) did the trick for us.
Next time I will consider manual autoincrement or Number sequence like in Orders, etc.