Re: Forms 4.5 - Newbie Master Detail Q

From: Todd Owers <toddo_at_gcr1.com>
Date: Fri, 11 Sep 1998 16:51:44 -0500
Message-ID: <6tc65n$l1c$1_at_nntp.gulfsouth.verio.net>


Instead of using a master-detail relationship to populate the description field, use a Post-Query trigger on the skill_profile block. Create a non-base table item in the skill_profile block to hold the description. Under the Program Units node in the Object Navigator, create a procedure as follows:

PROCEDURE populate_skill_code_description IS BEGIN
  SELECT description
  INTO :skill_profile.description
  FROM skill
  WHERE skill.skill_code = :skill_profile.skill_code; END; Call this procedure from the Post-Query trigger (to populate the description field when existing records are retrieved) and from a When-Validate-Item trigger on the :skill_profile.skill_code item (to immediately populate the description field when the user enters a skill code for a new record, if your form is set up that way). A Post-Query trigger fires once for each record in the block. So if you have three skill_codes in the skill_profile block, you will get three descriptions.

Be sure that the description field you create in the skill_profile block has the Base Table Item property set to False. Otherwise, you will get the "FRM-40505: Oracle error - unable to perform query" message, because the description field does not correspond to a column in the skill_profile table.

Hope this helps.

Todd Owers

W. David Donaldson wrote in message
<6tbp9j$ngq$1_at_mendelevium.btinternet.com>...

[snip]

>The columns in the tables are:
>
>Employee:
>Employee_no
>First_name
>Surname
>Grade
>
>Skill_profile:
>Employee_no
>Skill_code
>Skill_level
>
>Skill:
>Skill_code
>Description
>
>What I'm trying to do is create a form which will show all the skills
>for one employee. I therefore set up relations under the employee and
>the skill_profile blocks with the following conditions:
>
>Employee:
>Master Employee
>Detail Skill_profile
>Join condition: Employee.employee_no = Skill_profile.employee_no
>
>Skill_profile:
>Master Skill_profile
>Detail Skill_code
>Join condition: Skill_profile.skill_code = Skill.skill_code
>
>
>The problem is that because I've set up an inverted relationship between
>the skill profile and skill, although multiple records are displayed for
>the skill_code and the skill_level, only one record is returned for the
>description. In order to display each description (which is taken from
>Skill) for each Skill_code(taken from skill_profile) the user has to
>click in each skill_code field.
>
>Is there a way that I can set this up so that all the descriptions are
>displayed for all the skill_codes?
>
>I'd really appreciate any advice as I'm a new user to Dev/2000. Thanks.
>
Received on Fri Sep 11 1998 - 23:51:44 CEST

Original text of this message