Urgent 4.5 question

From: Maria T <mtproc_at_my-deja.com>
Date: Fri, 28 May 1999 14:52:20 GMT
Message-ID: <7imaj3$l1c$1_at_nnrp1.deja.com>



Hi,

I have a 2 block master detail form which allows entries of multiple divisions against a user. One of the divisions entered must be assigned as primary division via a check box. the validation ensures that one and not more, of the divisions has been assigned as the primary divsion.

i have done this via POST-FORMS-COMMIT trigger. Code as follows

DECLARE
 vPrimaries NUMBER := 0;
BEGIN

  SELECT 	COUNT(*)
  INTO		vPrimaries
  FROM		ye2_user_divisions
  WHERE		user_id = :YE2_COPS_USERS.user_id
  AND 		primary_division = 'Y';

  IF vPrimaries = 0
  THEN
     Msg_Alert('You must assign a primary division');   ELSIF vPrimaries > 1
  THEN
     Msg_Alert ('User may only be assigned one primary division');   END IF;
END; On first commit the error is trapped as expected. However if details commited a second time the details in the top block are commited even tho the validation fails. (The Procedure Call Msg_Alert uses RAISE FORM_TRIGGER_FAILURE). Why is this?

Any suggestions as to alternative method of achieving this would also be appreciated.

TIA Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Fri May 28 1999 - 16:52:20 CEST

Original text of this message