Home » Developer & Programmer » Forms » Alert firing several times (Windows 10 pro with Oracle forms 11g 31 bit)
Alert firing several times [message #679198] Fri, 14 February 2020 13:00 Go to next message
buggleboy007
Messages: 282
Registered: November 2010
Location: Canada
Senior Member
I have a form that has 2 blocks. Let's call the first block as
CRITERIA
.
This block has an id which when queried retrieves several transactional records from the second block called
WEB_CATALOGUES
.

This CRITERIA block has a button called 'DESELECT' which deselects all the transactional records from WEB_CATALOGUES block. When it de-selects the records, let's say that there are 200 transnational records, then there is an alert that displays 200 times. I want it to be displayed only once irrespective of whether I select 1 record or 100 records. How can I ensure that the alert fires only once?

I followed the suggestions given in 'http://www.orafaq.com/forum/t/195560/', but that does not even fire an alert.

Here is the code that is present in 'DESELECT' button :

IF :CRITERIA.SITE_ID IS NULL THEN 
  rams$msg_ofg45('E', TRUE, '709304%1Web site');
END IF;

IF :WEB_CATALOGUES.STYLE_ID IS NULL OR :WEB_CATALOGUES.COLOR_ID IS NULL THEN 
  rams$msg_ofg45('E', TRUE, 720011);	
END IF;  

BEGIN
	go_block('WEB_CATALOGUES');
  first_record;
  LOOP
    :WEB_CATALOGUES.CHECK_IND :='N';
    :WEB_CATALOGUES.DE_ACTIVATED_IND :='Y';
    IF :system.last_record <> 'TRUE'
    THEN
      next_record;
    ELSE
      EXIT;
    END IF;
  END LOOP;
  first_record;
END;
Then there is code at record level under WEB_CATALOGUES level:
 DECLARE
	alb NUMBER;
	t_error_text varchar2(250);
  v_result number; 	
 BEGIN
	 IF :WEB_CATALOGUES.STYLE_ID IS NOT NULL THEN
	 	
	    	IF :WEB_CATALOGUES.DISPLAY_FROM_DATE IS NULL THEN 
	  			rams$msg_alert('709304%1From Date','E',true);
	  		END IF;
	  
	  		IF :WEB_CATALOGUES.DISPLAY_TO_DATE IS NULL THEN 
	  			rams$msg_alert('709304%1To Date','E',true);
	  		END IF;	

	  	  IF :WEB_CATALOGUES.CHECK_IND = 'N' AND :SYSTEM.RECORD_STATUS = 'INSERT'	THEN 
	  	  	Set_Record_Property(get_block_property('WEB_CATALOGUES', CURRENT_RECORD), 'WEB_CATALOGUES', STATUS, QUERY_STATUS);
	  	  END IF;
	  		
	  		IF :WEB_CATALOGUES.CHECK_IND = 'N' AND :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
	  	    t_error_text:= lmsg.look_message(720004, :global.language_name);
	  			set_alert_property('CG$ASK_COMMIT', alert_message_text, t_error_text);
	  		  alb := show_alert('CG$ASK_COMMIT'); --THIS IS THE ONE THAT IS FIRING SEVERAL TIMES
	  		    
	  		  IF 	alb = alert_button1 THEN
	           NULL;	          
	        ELSIF alb = alert_button2  THEN
	  				RAISE FORM_TRIGGER_FAILURE;
	        END IF;  
	        END IF;
	   	  ELSE 
	    rams$msg_ofg45('E', TRUE, 720011);	
	 END IF;  
END;
I commented the above and put this one in
PRE-UPDATE
at block level (WEB_CATALOGUES), but the alert never even fired.

How can I resolve this issue?i.e. ensure that the user only sees this alert once (when he selects all the records). The alert message is: You are about to purge all the records? Continue...
Re: Alert firing several times [message #679199 is a reply to message #679198] Fri, 14 February 2020 15:41 Go to previous messageGo to next message
buggleboy007
Messages: 282
Registered: November 2010
Location: Canada
Senior Member
I think I have fixed it myself. I unit tested it and there are no issues. I will have to try out a few more options before concluding it.
Re: Alert firing several times [message #679246 is a reply to message #679199] Tue, 18 February 2020 15:55 Go to previous message
buggleboy007
Messages: 282
Registered: November 2010
Location: Canada
Senior Member
This is the correct answer and most of my unit test results have passed. There is only one minor issue which I will post as a fresh thread.
Previous Topic: frm-92090 unexpected fatal error in client-side java code during startup (merged)
Next Topic: sending email from forms with report in pdf as an attachment
Goto Forum:
  


Current Time: Thu Mar 28 10:17:08 CDT 2024