Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Anyway to have related table fk not required field?

Quote Reply
Anyway to have related table fk not required field?
I know foreign keys, by their very nature, are supposed to be NOT NULL. However, I'm wondering if there's anyway to work around that with related tables in DBMan SQL. I would like the ability to create a relationship and create a select menu on the related table based on the primary table, but have it be an optional field. Is this possible? Many thanks for any assistance.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] Anyway to have related table fk not required field? In reply to
This is just a one-or-zero-to-many relation. Smile I wouldn't know why this would not be possible. Did you try it? If so, where does it fail?

Jasper

http://www.bookings.org
Quote Reply
Re: [jaspercram] Anyway to have related table fk not required field? In reply to
Thanks for the reply.

It fails because when you establish a relationship between two tables and configure DBMan SQL to create a select list on the related table from a particular column in the primary table, that select list field automatically becomes required. If you don't select from the list when adding or modifying a record, it returns REL_ERROR_FK.

Any thoughts? Thanks again.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] Anyway to have related table fk not required field? In reply to
<bump>

Anyone from GT have a suggestion on this?

Thanks.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] Anyway to have related table fk not required field? In reply to
Hi,

That means it will against the rules of relational database. Anyway, you can customize the code a little bit as the way you wanted by searching for:

Code:
#Check foreign keys
my $msg = $self->_check_fk();

and replace with:

Code:
my $msg;



Hope that helps.

TheStone.

B.