tsanchez
10th December 2001, 09:54
Dear friends. Is there someway I could switch off the referential
integrity of a table through some 4GL instruction ? I would need
to do so in a session I'm currently working in. Thanks in advance.
Tomas Sanchez Tejero
tsanchez@consultant.com
tsanchez
10th December 2001, 11:02
I must add it's possible to switch off the referential integrity
restriction on session "ttaad4227m000: Create table from
secuential dump" marking "disable referential integrity
restriction". Although , I don't know how it's been solved
internally. I hope it helps.
Tomas Sanchez Tejero
tsanchez@consultant.com
lsatenstein
15th December 2001, 00:34
Here is what I did to get around your problem of referential integrity. It probably won't work for your situation, but it may give you an idea of how to proceed.
For the fields requiring a referential integrity check, create a fixed specific reference in the referenced table, and use that information as a default value in the table field for the row you are inserting.
When you finally need to put in the appropriate references, you would search for the records having your known values, and then you would replace those values with the needed production values.
The problem with the above is that the table row with the modified fields had better have the field information stored elsewhere so that it would be available for reconstructing.
APPROACH 2
Change the domain definition of the table fields to skip the referential integrity check.
Approach 3
Assume input is from a flat file, put it out in a format so that it could be loaded with the baan utility (having the ref check switch turned off)
Good luck
tsanchez
20th December 2001, 11:35
Dear Leslie. Thanks for your quick answer. I think your first choice
would surely prove to be the most helpful. Could you please tell
me how could I create those specific references ? I confess I'm
somewhat lost. Which option should I take on maintain definition
tables session ?
Read you soon.
Tomas Sanchez Tejero
tsanchez@consultant.com
Han Brinkman
20th December 2001, 12:40
Tomas,
The option in create table session turns a switch on (-m or -n, i have to look that up) for the bdbpost.
As far as I know it's not possible to turn the referential integrity off in a 4-Gl script.
If you must have it turn off you could change the table definition if you have a developer licence, at the field level the references are defined.
If you don't have a developing licence you have to hack the dd files directly but I guess that's not what you want.
Rgrds,
Han
norwim
20th December 2001, 12:57
Hi Han,
I always use both -n and -m, never can remember which is which. (It's not explained in the tools-help, btw)
Tomas,
if you have to load for instance two files, each using a referenced field of the other, you could never achieve that if you couldn't switch of the check for referential integrity. Therefor the program invoked by "Create Table from sequentialDump, ttaad4227m000"
[bdbpre6.1] has two switches to turn of the check and ignore empty (referenced) fields. In ttaad4227m000 you would check the checkboxes named "Disable domain constraints" and "Ignore referential integrity constraints" to achieve this.
As Han pointed out, there is no such option for a 4GL program.
If you have to use a program, stick to Leslies advice and fill the fields in question with a value you entered into the referenced table (value "XXX" with ttaad4100 for example). Later you can retrieve these records and change the value to a correct one.
Hope that helped
Norbert