On Sep 29, 2011, at 11:31 AM, Vineet Deodhar wrote:
>> First, you have a column 'wrmstnm' that is marked as NOT NULL, but with no
>> default value. When you try to associate a value to the mdlmst record, if
>> that value isn't found, the
>> record is added. Unless the field you are using to associate is 'wrmstnm',
>> there will be no value, and the insert will fail.
>
> In case a user does not specify a value for 'wrmstnm', and suppose that
> form-level validation is also deceived or bye-passed somehow.
> Then, if the database will insert 'default value' and silently save the
> record, without any error (which is, in some casaes, undesirable).
> That's why it is is marked as NOT NULL, but with no default value. Sothat the
> DB will raise error.
OK, but in the test code there is no form or validation or anything.
The reason the test was failing for me was because the DB was rejecting the
insertion of the wrmstnm null value, not because the MM code wasn't working.
> To the users, the pkids will not be shown, but the names will be shown on
> form / report.
> It is very natural to use pkid to link parent & child tables.
The association table for the MM relationship uses PKs to establish the
links; that's what they are for.
> Some of the reasons are--
> i) There can be duplicate names. But pkids will be unique.
But if the user is doing the selection, and you present her with two
choices with the same name, you have bigger problems. :)
> ii) Maintainability: Suppose a name of warranty (wrmstnm) is changed in
> master (wrmst) (maybe to correct a typo)
> If pkid of that table is referenced in child table, then nothing else needs
> to be changed in earlier transaction tables.
Again, that's what PKs are for: to link tables, and that's what Dabo
uses. But your sample code didn't provide the other columns that were required.
Once I change it to include a default value, the code worked fine.
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]