Home » Developer & Programmer » Forms » not saving (forms6i)
not saving [message #498002] Tue, 08 March 2011 02:52 Go to next message
cyrsprite
Messages: 26
Registered: March 2011
Location: Manila, Philippines
Junior Member

im now doin' my currently program, actually they requesting for an update. I added birth date column in the module,they asked to the request to put a validation on date, such as:

a. under age
b. :txt_ph_birthdate > SYSDATE

c. if :txt_plan_type = 212 then

17 yrs, 5 mos and 29 days and 40 yrs, 5 mos and 29 day - as validation

d. if :txt_plan_type = 214 then

40 yrs and 6 mos and 55 yrs, 5 mos and 29 days - as validation

e. if :txt_plan_type = 215 then

17 yrs, 5 mos and 29 days and above - as validation


they also instructed me to put the validations in birth date after the column of birthdate, which is the :txt_plan_type(list_item) and i put it in TRIGGER (when-validate-item)

after i did the codes and compile it., theres no message for error

but i think its not working..it working. i already updates also the insert and the other trigger and procedure, i just add the plan type on it.

i havent edit the save button because the as i read the codes the it just call the procedure that i edit.

when i run the program and after i encode the data..and when i press the save button, nothing happens or any confirmation.

hope u can send and advice..thanks

in addition, why is it that my validation on age doesnt work?

heres the code:

declare
  n_months_between   NUMBER;
  d_same_day_occur   DATE;
  n_years            NUMBER;
  n_months           NUMBER;
  n_days             NUMBER;
  al_button	     number;
  
  vApl		     number;

BEGIN
	
	begin
  	  select count(*)
  	    into vApl
  	  from appl_or_dtls
  	  where appl_appl_nr = :txt_appl_no;
  	exception
  	  when no_data_found then
  	  vApl := null;
       end;

  n_months_between := TRUNC(MONTHS_BETWEEN(:txt_received_dt, :txt_ph_birthdate));
  n_years          := TRUNC(n_months_between / 12);
  n_months         := n_months_between - (12*n_years);
  d_same_day_occur := ADD_MONTHS(:txt_ph_birthdate,    n_months_between);
  n_days           := :txt_received_dt - d_same_day_occur;


if :txt_plan_type in (212,214,215) then
   if :txt_ph_birthdate > SYSDATE then
      set_alert_property('note_alert',title,'Alert');
      set_alert_property('note_alert',alert_message_text,'Birthdate is greater than system date.');
  	   al_button := show_alert ('note_alert');
  	   raise form_trigger_failure;
  	
  elsif ((n_years * 10000 + n_months * 100 + n_days) < 170529) then
  	set_alert_property('note_alert',title,'Alert');
  	set_alert_property('note_alert',alert_message_text,'PH is underage.');
  	al_button := show_alert ('note_alert');
  	raise form_trigger_failure;
  	end if;
  end if;

if :txt_plan_type = '212' then
  	if ((n_years * 10000 + n_months * 100 + n_days) < 170529) and ((n_years * 10000 + n_months * 100 + n_days) > 400529) then
        set_alert_property('note_alert',title,'Alert');
       set_alert_property('note_alert',alert_message_text,'Please check! MSB Prime is Age 40 and below.');
  	al_button := show_alert ('note_alert');
  	raise form_trigger_failure;
  	end if;

elsif :txt_plan_type = '215' and 
  	 ((n_years * 10000 + n_months * 100 + n_days) < 170529) then
  	set_alert_property('note_alert',title,'Alert');
  		set_alert_property('note_alert',alert_message_text,'Please check! MSB Gold is Age 56 and Above.');
  	al_button := show_alert ('note_alert');
  	raise form_trigger_failure;
  	end if;
end;

Re: not saving [message #498012 is a reply to message #498002] Tue, 08 March 2011 04:08 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
after i encode the data..and when i press the save button, nothing happens or any confirmation.

Did WHEN-VALIDATE-ITEM trigger fire at all? If you don't know, put MESSAGE in there and it will display a message when execution enters that trigger. Besides, if :TXT_PLAN_TYPE is not among 212, 214, 215 nothing's going to happen. (note that sometimes you use it as a number, sometimes as a character. What is it? You should correctly use its value).

What does "save button" do? Is it default Forms "Save" button (i.e. no additional code behind it)?
Re: not saving [message #498022 is a reply to message #498012] Tue, 08 March 2011 05:00 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
To check your age validation use message to display the value of
n_years * 10000 + n_months * 100 + n_days


You should also format your code so that the if/elsif/end ifs line up properly.
Re: not saving [message #498048 is a reply to message #498022] Tue, 08 March 2011 07:20 Go to previous messageGo to next message
cyrsprite
Messages: 26
Registered: March 2011
Location: Manila, Philippines
Junior Member

thank guys.. i got already, i just add checking and assin the values of age..then i declare values for it..my problem is, it didnt save the transactions that i made..
Re: not saving [message #498050 is a reply to message #498012] Tue, 08 March 2011 07:23 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Littlefoot wrote on Tue, 08 March 2011 10:08

What does "save button" do? Is it default Forms "Save" button (i.e. no additional code behind it)?

Re: not saving [message #498133 is a reply to message #498050] Tue, 08 March 2011 21:17 Go to previous messageGo to next message
cyrsprite
Messages: 26
Registered: March 2011
Location: Manila, Philippines
Junior Member

"SAVE BUTTON" or the BTN_SAVE

it has codes actually.


declare
	or_num 			varchar2(20);
	amt_diff		number (12,2);
	rcvd_by			varchar2(8);
	remarks			varchar2(60);
	inst_amt		number (12,2);
	rem_tag			number (1);
	al_button		number;
	nPRcnt      		number;
	nApplCnt    		number;
	totPaid			number(12,2);
	vAppl_no		varchar2(10);
	valid_paylite		number;

begin

	if nvl(:rg_search,0)  <> 0 then	 
	   show_view('password');
	   go_item('password_id');
	else	
          if :save_flag is null then 
	  :cash := nvl(:txt_total_cash, 0);
	  :chk	:= nvl(:disp_total_check, 0);
	  :ccard := nvl(:disp_total_ccard, 0);
				
	  if :disp_error_flag = 'Y' then
	     set_alert_property ('note_alert', title, 'Information');
	     set_alert_property ('note_alert', alert_message_text, 'No price found, please check contract details...');
	     al_button := show_alert ('note_alert');	
	     raise form_trigger_failure;
	     end if;	 		

         validate_mandatory_fields;

        if :rg_ts_code = 4 then
           if :tmp_block.disp_copy_phname <> :tmp_contr_det.txt_ph_name then
           set_alert_property ('note_alert', title, 'Error');
           set_alert_property ('note_alert', alert_message_text, 'Multiple plans should have the same PH Names');
           al_button := show_Alert ('note_alert');
           raise form_trigger_failure;
           end if;

	if nvl(:disp_total_amt_paid,0) = nvl(:dsp_amt_paid,0) and 
		(( :disp_pr_yr is null ) or (:disp_pr_yr is not null and nvl(:disp_total_pr,0) = nvl(:dsp_amt_paid,0)and 
					nvl(:disp_total_amt_paid,0) = nvl(:dsp_amt_paid,0) )) then
						 		
	:disp_trans_id := generate_trans_id;

        set_alert_property ('yes_no_alert', title, 'Confirmation');
        set_alert_property ('yes_no_alert', alert_message_text, 'Transaction Details will now be saved... Are you sure?');
        al_button := show_Alert ('yes_no_alert');

        if al_button = 88 then
			 
	go_block('pymnt_pr');
	last_record;
	nPRcnt  := :system.cursor_record;
												
	if nvl(nPRcnt,0) > 1 and nvl(:appl_count,0) > 1 then
	set_alert_property ('note_alert', title, 'Warning!');
	set_alert_property ('note_alert', alert_message_text, 'This type of transaction is not allowed. Please encode either 1 PR with many applications or 1 application with many PR''s.');
	al_button := show_alert ('note_alert');	
	raise form_trigger_failure;	
																

	else

	if :rg_src_pymnt = 'DO' then
	   if func_validate_appl_amt  = 'N' and :pr_nr is null then
	   set_alert_property ('note_alert', title, 'Information');
	   set_alert_property ('note_alert', alert_message_text, 'Amount due is greater than amount paid, please issued Provisional Receipt for this transaction, Official Receipt can be generated after amount paid is greater or equal to amount due.');
  al_button:=show_alert('note_alert');												     set_item_property ('pr_nr',	enabled, property_true); 
  set_item_property ('disp_pr_yr', enabled, property_true);   
  set_item_property ('orpr_pr_date', enabled, property_true);  
  set_item_property ('orpr_pr_exp_dt', enabled, property_true);  
  set_item_property ('orpr_total_amt', enabled, property_true);  
														   	  
  set_item_property('pr_nr',visual_attribute,'visual_mandatory');
  set_item_property('disp_pr_yr',visual_attribute,'visual_mandatory');
  set_item_property('orpr_pr_date',visual_attribute,'visual_mandatory');
  set_item_property('orpr_pr_exp_dt',visual_attribute,'visual_mandatory');
  set_item_property('orpr_total_amt',visual_attribute,'visual_mandatory');
  set_item_property ('disp_pr_yr', enabled, property_true);
															  
  :disp_pr_yr := '2008';
  begin
    select distpr_pr_code
	into :disp_pr_district
    from district_pr
    where distpr_code = :disp_dist_code
    and distpr_region = :global.location;
    exception 
    when no_data_found then
    :disp_pr_district := null;
    end;
														   	  
    go_item('pr_nr');
    raise form_trigger_failure;
														      
    elsif :cb_check = 1 and  :chk_date > trunc(sysdate) and :pr_nr is null then 
    set_alert_property ('note_alert', title, 'Information');
    set_alert_property ('note_alert', alert_message_text, 'Issuance of Official Receipt for post dated check payments will follow after the said check date, meanwhile Provisional Receipt will be issued');
    al_button := show_alert  ('note_alert');														
   set_item_property ('pr_nr', enabled, property_true); 
   set_item_property ('disp_pr_yr', enabled, property_true);   
   set_item_property ('orpr_pr_date', enabled, property_true);  
   set_item_property ('orpr_pr_exp_dt', enabled, property_true);  
   set_item_property ('orpr_total_amt', enabled, property_true);  
														   	  
   set_item_property('pr_nr',visual_attribute,'visual_mandatory');
   set_property('disp_pr_yr',visual_attribute,'visual_mandatory');
   set_item_property('orpr_pr_date',visual_attribute,'visual_mandatory');
   set_item_property('orpr_pr_exp_dt',visual_attribute,'visual_mandatory');
   set_item_property('orpr_total_amt',visual_attribute,'visual_mandatory');
   set_item_property ('disp_pr_yr', enabled, property_true);
																  
   :disp_pr_yr := '2008';
   begin
	select distpr_pr_code
	  into :disp_pr_district
	from district_pr
	where distpr_code = :disp_dist_code
	and distpr_region = :global.location;
	exception 
	when no_data_found then
	:disp_pr_district := null;
	end;
													   	  
	go_item('pr_nr');
	raise form_trigger_failure;
													   
	else
															  	
	insert_values;
	:System.Message_Level := 25 ;   
	commit_form;  	
	:System.Message_Level := 0;
	:save_flag  := 'S';	
	go_item('btn_clear');
	set_item_property('btn_save', enabled, property_false);
	end if;	
											
 	elsif :rg_src_pymnt <> 'DO' then

	if :txt_amt_due > :txt_amt_paid  then
	set_alert_property ('note_alert', title, 'Information');
	set_alert_property ('note_alert', alert_message_text, 'Amount due is greater than amount paid,.');
	al_button := show_alert ('note_alert');
	set_item_property('btn_distribution',enabled,property_false);	
	end if;	

	insert_values;
	:System.Message_Level := 25 ;   
 	commit_form;  	
	:System.Message_Level := 0;
	:save_flag  := 'S';	
	go_item('btn_clear');
	set_item_property('btn_save', enabled, property_false);
												
	end if; 			
											
-- validation for enabling generate button for printing OR(s)						          
	if :chk_date <= trunc(sysdate) or :chk_date is null then								
	   if :chk_or_info = 'M' then
	      set_alert_property ('note_alert', title, 'Information');
	      set_alert_property ('note_alert', alert_message_text, 'Saving done.');
	      al_button := show_alert ('note_alert');	
	      set_item_property('btn_distribution',enabled,property_true);
	      go_item('btn_distribution');

	    else
               
                if :rg_src_pymnt = 'FC' and :rg_ts_code not in (2,3) and :txt_plan_type = 211 and :txt_mode = '1' and :txt_gp = 53280 then
                  set_alert_property ('note_alert', title, 'Information');
		  set_alert_property ('note_alert', alert_message_text, 'Saving done. Official Receipt(s) cannot be generated.');
	          al_button := show_alert ('note_alert');		
	          set_item_property('btn_distribution',enabled,property_false);
	          proc_clear;
			           go_item('btn_search'); 												

                else
               

									
		if nvl(:ccard_amt, 0) > 0 and :ccard_provider_code in ('7', '8') and instr (:ccard_appr_code, 'PAYLITE') > 0 then
		valid_paylite := validate_paylite_amt;
		end if;	
												 		
		if nvl(valid_paylite, 1) = 1 then
		go_block('tmp_contr_det');
		first_record;
													 	  
		if :txt_amt_due > :txt_amt_paid then
		begin 
		select sum(distinct(nvl(prorlink_amt_pd ,0)))
		into totPaid
		from pr_or_link
		where prorlink_appl_nr = :txt_appl_no
		and prorlink_or_nr is null;
		exception
		when no_data_found then
		totPaid := 0;
		end;

		if totPaid < :txt_amt_due  then
		set_alert_property ('note_alert', title, 'Information');
		set_alert_property ('note_alert', alert_message_text, 'Saving done. Official Receipt(s) can be generated if amount paid is greater than or equal to amount paid.');
		al_button := show_alert ('note_alert');		
		set_item_property('btn_distribution',enabled,property_false);
		proc_clear;
		go_item('btn_search'); 												

		else
		set_alert_property ('note_alert', title, 'Information');
	        set_alert_property ('note_alert', alert_message_text, 'Saving done.  Please use "SEARCH" button to generate Official Receipt(s).');
		al_button := show_alert ('note_alert');	
	        set_item_property('btn_distribution',enabled,property_false);
		proc_clear;
		go_item('btn_search'); 												
		end if;

		else												 	  	
		set_alert_property ('note_alert', title, 'Information');
		set_alert_property ('note_alert', alert_message_text, 'Saving done.  Official Receipt(s) can now be generated.');
		al_button := show_alert ('note_alert');	
		set_item_property('btn_distribution',enabled,property_true);
		go_item('btn_distribution');
		end if;
												
		else -- invalid paylite trans, disable generate OR button
		set_alert_property ('note_alert', title, 'Information');
		set_alert_property ('note_alert', alert_message_text, 'Credit card amount for Paylite transaction must be at least 3,000 Pesos.' || CHR(10) || CHR(10) ||'Official Receipt can be generated once the total credit card amount for this approval number reaches minimum amount.' );
		al_button := show_alert ('note_alert');		
		set_item_property('btn_distribution',enabled,property_false);
		proc_clear;
		go_item('btn_search');	
		end if; -- check if valid paylite trans or regular trans
                end if;  
		end if;	-- check_or_info 'M'
		elsif :chk_date > trunc(sysdate) then -- postdated checks							
		set_alert_property ('note_alert', title, 'Information');	
		set_alert_property ('note_alert', alert_message_text, 'Saving done. Official Receipt(s) can be generated on check date');
		al_button := show_alert ('note_alert');	
		set_item_property('btn_distribution',enabled,property_false);
											 
					  end if; 
							 			
				  end if; 
			  end if;		
			
		  else
		    set_item_property('btn_distribution',enabled,property_false);
		    set_alert_property ('note_alert', title, 'Warning');
		    set_alert_property ('note_alert', alert_message_text, 'Saving not allowed! Please check...' || CHR(10) ||'PR Amount, Contract details total amount paid and '|| CHR(10) ||'Payment details total Amount Paid are not tally!');
		    al_button := show_alert ('note_alert');
		    raise form_trigger_failure;		  
		  end if;	
	  end if;
  end if;	

	end if;
end;


what i did i just add a column in canvass and i also edit the procedure that is called by the btn_sve but nothings happened.




Re: not saving [message #498158 is a reply to message #498133] Wed, 09 March 2011 00:17 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, quite a lengthy trigger. Unfortunately, it is badly formatted and difficult to follow.

There are two COMMITs there. If - as you said - "when i press the save button, nothing happens or any confirmation" - maybe all IFs you thought would do "something" did "nothing". The only way to know it for sure is to debug it. Unfortunately, Forms 6i don't have debugger so you'll have to trace the code manually, by adding MESSAGE built-ins so that you'd know what is going on.
Re: not saving [message #498242 is a reply to message #498158] Wed, 09 March 2011 05:34 Go to previous messageGo to next message
cyrsprite
Messages: 26
Registered: March 2011
Location: Manila, Philippines
Junior Member

thanks guys, but i solve already my problem, the reason is, when i debugged my program..

but theres one more error, that pump out when i search the data that i encoded..although the i can search the data but there an error

"FRM 40737: Illegal restricted procedure Go_ITEM in When-Validate_item Trigger"

Re: not saving [message #498247 is a reply to message #498242] Wed, 09 March 2011 05:46 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You can't use restricted procedures in triggers (or procedures called by those triggers) that fire in response to navigation. GO_ITEM won't work in WHEN-VALIDATE-ITEM trigger.

Question is: what are you trying to do and how? Post your code (make sure to properly format it this time).
Previous Topic: Getting calculation result from 2 form text boxes
Next Topic: order entry application
Goto Forum:
  


Current Time: Tue Sep 17 05:09:01 CDT 2024