Arced, Multiple, Master - Detail

From: Jochen Van den Bossche <Jochen.Van-Den-Bossche_at_eurocontrol.be>
Date: Fri, 18 Dec 1998 10:02:44 +0000
Message-ID: <367A2844.256C_at_eurocontrol.be>



[Quoted] I have allredy anwered some questions in this use newsgroup, now it is my time to ask one...

Imagine a forms with four blocks:
One control block (CONTROL)
3 Master blocks (CLIENT, STAFF, USER_CLASS) set to only allow query. one detail block (NETWORK_SYSTEM_ACCESS)

The NETWORK_SYSTEM_ACCESS table/block contains 3 FK items to each of the 3 masters (CL_IS_NR, STF_ID_NR, USRCLASS_ID_NR). Every master block has a relation to the detail.
Only one of these FK may be filled in: an arc. This means that a NETWORK_SYSTEM_ACCESS is for a CLIENT xor for a STAFF xor for a USER_CLASS. (xor: eXclusive OR)

The control block has a radio group that is displayed on the first canvas. This radio group hasd a when-radio-changed trigger attached. This triggers displays one of three canvasses, each showing one of the master blocks. That means that if the user clickes the client radio button a canvas appears with the client block. Showing these blocks is not my problem. I use stacked canvassses and use hide_view() to hide two of them and go_block() to display the other
(selected) one.

When a block is displayed a query can be executed to display some recors
(eg clients, staff memebers, user-classes).
When a record is selected, the FK field in the detail is automatically filled in. This is still what I expect / normal / desired action.

HERE COMES THE PROBLEM:
Suppose the user has to define a network access for 'somebody'. He/she presses the client button. The client block appears. He/she executes a query, and the first record is automatically selected and thus the FK filled in. Now the user realises that 'somebody' isn't a client but a staff member.
He/she therefore clickes the staff button. The staff block appears. Quyery ... FK filled in. BUT THE FK POINTING TO A CLIENT IS NOT DELETED.

I can except that the FK isn't deleted automatically, so I tried to write code for this in the when-radio-changed trigger. I tried lots of things: A go_block('NETWORK_SYSTEM_ACCESS') followed be clear_Record() or delete_Record() doesn't work (the FK remains set). Assignig a NULL value to the FK items doesn't work either: The forms indicates that a value must be entered for the primary key, but i do not want to keep that record at all!

An on-insert trigger can be written to chack that one and only one of the three FK's is filled in, but on-insert is too late! In the final application the network_suystem_access block will not be visible since it contains only a PK and 5 FK's: Nothing readable for the user. So a user will not understand what is going on if he/she gets a message sayinh that only one of the 3 fk's may be filled in, moreover, the user will not even be able to navigate to the FK fields to delete them...

Any solutions?
[Quoted] How do I delete these fields, or set them to null? Received on Fri Dec 18 1998 - 11:02:44 CET

Original text of this message