Re: Oracle Forms 9 Problem

From: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 01 May 2006 14:08:04 -0700
Message-ID: <1146517690.367728_at_jetspin.drizzle.com>


Sykiemikey wrote:
> I am learning forms with Oracle 9i and have run into a problem.
>
> The following code runs just fine in a Save Button with a WHEN
> -BUTTON-PRESSED trigger that inserts a record from a stacked single
> record block (does not allow updates or deletes from it).
>
> DECLARE
> edit_alert alert;
> show boolean := false;
> message varchar2(150) := 'You Must Fill the Following Fields:';
> choice number;
> BEGIN
> IF :add_region.region_id IS NULL THEN
> show := true;
> message := message || CHR(10) || '----- Region Id';
> END IF;
>
> IF show = true THEN
> edit_alert := Find_Alert('EDIT');
> set_alert_property(edit_alert, ALERT_MESSAGE_TEXT, message);
> choice := show_alert(edit_alert);
> ELSE
> insert_record;
> commit;
> clear_block;
> go_block('regions');
> END IF;
> END;
>
> But when I try to use the following trigger on a Save button which is
> almost identical on a table canvas with a multi-line block that allows
> queries, updates and deletes...it basically skips the IF....IS NULL
> section because the show never turns true and the alert never fires so
> it automatically trys to update the record, but fails because of the
> null value. It works perfect if the item is not null and gets inserted.
> I figure that it has something to do with :regions.region_id within a
> multi-line block and the if statement not knowing the current record.
> I have searched and searched for a solution with no luck. Can anyone
> help?
>
> DECLARE
> edit_alert alert;
> show boolean := false;
> message varchar2(150) := 'You Must Fill the Following Fields:';
> choice number;
> BEGIN
> IF :regions.region_id IS NULL THEN
> show := true;
> message := message || CHR(10) || '----- Region Id';
> END IF;
>
> IF show = true THEN
> edit_alert := Find_Alert('EDIT');
> set_alert_property(edit_alert, ALERT_MESSAGE_TEXT, message);
> choice := show_alert(edit_alert);
> ELSE
> update_record;
> commit;
> END IF;
> END;
>
> I appreciate any time and help....
>
> Michael
>

Check the value of the :SYSTEM.BLOCK_STATUS, :SYSTEM.FORM_STATUS and :SYSTEM.MODE environment variables.

Daniel Morgan
www.psoug.org Received on Mon May 01 2006 - 23:08:04 CEST

Original text of this message