Home » Developer & Programmer » Forms » issue with form trigger failure (forms 10g, win xp sp3)
issue with form trigger failure [message #599637] Sun, 27 October 2013 08:54 Go to next message
m_shehpar
Messages: 73
Registered: October 2010
Location: Pakistan
Member
Hi all,



I have a scenario wherein two columns compute a third one. i.e. quantity and unit_price computes "functional_amount". the column "functional amount" property disabled is set to true but there are a number of validations performed on it. Now when on a certain event "form_trigger_failure" is to be fired. the validation trigger fires multiple times (may be...).



the error alert that i have devised, is shown multiple times along with the message "validation at disabled item "functional amount" failed !". both of these messages follow one after the other unless i close the applet.



kindly help me out at this



regards
Re: issue with form trigger failure [message #599641 is a reply to message #599637] Sun, 27 October 2013 14:35 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Try to enable that item before performing validation(s). Once it is done (either successfully or not), disable it back again.
Re: issue with form trigger failure [message #599687 is a reply to message #599641] Mon, 28 October 2013 04:36 Go to previous messageGo to next message
m_shehpar
Messages: 73
Registered: October 2010
Location: Pakistan
Member
Thanks little foot for your attention, I already thought of it. But still this validation is not doing my job.

Now the problem is that i've used timer and there a number of operations done there. in the end if a condition comes to be true it should fire form trigger failure, it is showing the alert which i've set prior to form_trigger_failure, but the navigations are not being stopped i.e., form_trigger_failure is not working there...

any help ???

regards
Re: issue with form trigger failure [message #599690 is a reply to message #599687] Mon, 28 October 2013 04:54 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
I think you need to supply more details of what you've actually done, the code from the relevant triggers would probably help.
If you've got form_trigger_failure in a when-timer-expired trigger though it's definitely not going to prevent user navigation.
Re: issue with form trigger failure [message #599695 is a reply to message #599690] Mon, 28 October 2013 05:14 Go to previous messageGo to next message
m_shehpar
Messages: 73
Registered: October 2010
Location: Pakistan
Member
thanks cookiemonster for your attention. following is the scenerio

** i got 3 columns relevant here, unit_amount, quantity and functional_amount (functional_amount is self computed by unit_amount * quantity)
** in validate trigger of functional amount, i check to see whether remaining budget amount for this line is adequate enough, for which i need to use looping and go_record etc, consequently i need to use timer
** in timer i have used a loop to find consumption of THIS budget in the current block and then compute BUDGET_AMOUNT - BLOCK_CONSUMPTION. if this amount is less than zero than form_trigger failure should have been fired with appropriate message. but it doesn't work
** below is my code at the timer

IF vcTimer = 'CALC_REM_AMT' THEN
	  CURR_REC := TO_NUMBER(:SYSTEM.TRIGGER_RECORD);
	  FIRST_RECORD;
		  
	  LOOP
	  	IF :RFN_LINES_ALL.BH_CC_ID = TO_NUMBER(:GLOBAL.BUD_ID) AND :SYSTEM.RECORD_STATUS IN ('INSERT','NEW') THEN
	  			CONSUMED_AMT := CONSUMED_AMT + :RFN_LINES_ALL.FUNC_AMOUNT;
	  	END IF;
	  	EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
 			NEXT_RECORD;
	  END LOOP;

	  :GLOBAL.BLK_CONS := CONSUMED_AMT; 
	  GO_RECORD(CURR_REC);
	  CONSUMED_AMT := CONSUMED_AMT - :RFN_LINES_ALL.FUNC_AMOUNT;

     SELECT cbb.AMOUNT
     INTO  bud_amt
 	 FROM  CONSUMED_BUDGET_BALANCES cbb
     	  ,BUDGET_LINES_ALL         bla
	 WHERE cbb.BL_ID    = bla.BL_ID
	 AND   bla.BH_CC_ID = :RFN_LINES_ALL.BH_CC_ID
	 AND   bla.TYPE     = :RFN_HEADERS_ALL.BUDGET_TYPE
	 AND   bla.INACTIVE_F is null;

		IF (bud_amt - nvl(consumed_amt,0)) - :RFN_LINES_ALL.FUNC_AMOUNT < 0 THEN
			al := FIND_ALERT   ('TRX_AMOUNT');
			set_alert_property ('TRX_AMOUNT', alert_message_text, :RFN_LINES_ALL.BUDGET_CODE || ' has '|| (bud_amt - nvl(consumed_amt,0)) || '/-- Rs. remaining !' );
			alrt := show_alert ('TRX_AMOUNT');
			GO_ITEM('RFN_LINES_ALL.UNIT_AMOUNT');
			RAISE FORM_TRIGGER_FAILURE;				
		ELSE
			next_record;
		END IF;			

ELSIF vcTimer = 'NEXT_REC' THEN
	.................		
Re: issue with form trigger failure [message #599697 is a reply to message #599695] Mon, 28 October 2013 05:27 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
What is it you expect form_trigger_failure to do?
Are you expecting it to stop the WVI completing? it won't. It'll fail the timer trigger and that will not affect anything else.
Re: issue with form trigger failure [message #599699 is a reply to message #599697] Mon, 28 October 2013 05:31 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
I think you need to calculate consumed_amt as you enter records - store it in a global as you go, then you shouldn't need to loop in the WVI trigger.
Re: issue with form trigger failure [message #599703 is a reply to message #599699] Mon, 28 October 2013 05:36 Go to previous messageGo to next message
m_shehpar
Messages: 73
Registered: October 2010
Location: Pakistan
Member
Thats not the problem brother !!! problem is, why does this RAISE FORM_TRIGGER_FAILURE; not working when my condition becomes true...

i've digged the entire form from one way to the other, each possible event is working fine, except this form_trigger_failure. i need to stop the navigation when this event becomes true and compel the user to abide by the rules...
Re: issue with form trigger failure [message #599704 is a reply to message #599703] Mon, 28 October 2013 05:46 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As you use Forms 10g, set breakpoint in front of RAISE FORM_TRIGGER_FAILURE and run the form in debug mode. It'll stop once it comes to the breakpoint; then execute your code step-by-step and see what's going on. Debugger will let you view many useful information, so maybe you'll see something interesting.
Re: issue with form trigger failure [message #599707 is a reply to message #599704] Mon, 28 October 2013 05:55 Go to previous messageGo to next message
m_shehpar
Messages: 73
Registered: October 2010
Location: Pakistan
Member
actually i can't... i have to integrate my forms to oracle r-12 suite and run it there. isn't there any other way around ???
Re: issue with form trigger failure [message #599709 is a reply to message #599704] Mon, 28 October 2013 05:57 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
form_trigger_failure is working. It's causing the when-timer-expired trigger to fail. That doesn't stop the when-validate_item completing at all.
A timer is like a DB job, it runs completely independently of the code that created it and it's failure has no effect on the calling trigger.
If you want to stop the user from navigating out of the item then you need to raise form_trigger_failure in the when-validate-item trigger.
So you can't use a timer for this.
Re: issue with form trigger failure [message #599833 is a reply to message #599709] Tue, 29 October 2013 05:40 Go to previous messageGo to next message
m_shehpar
Messages: 73
Registered: October 2010
Location: Pakistan
Member
cookiemonster your help guided my through the right path, but still i am facing wearied responses.

can you please have a look on the below code which i have written on the when-validate-item trigger. Problem is, when the condition for "RAISE FORM_TRIGGER_FAILURE" is false, the validation trigger works fine but when it becomes true, the validation trigger seemingly runs infinite times and the form gets stuck. (i say so because i see the error: attempt to recreate existing timer along with the alert which i have devised)

Kindly help me out at this:

IF :RFN_LINES_ALL.FUNC_AMOUNT IS NULL THEN
	NULL;
ELSE
		
	IF :SYSTEM.RECORD_STATUS IN ('NEW','INSERT') THEN
						-- Check whether this budget code is already utilized in this block ...!!!
		:GLOBAL.BUD_ID := :RFN_LINES_ALL.BH_CC_ID;
		vTimer				 := create_timer('CALC_REM_AMT', 100, NO_REPEAT);
		block_cons		 := TO_NUMBER(:GLOBAL.BLK_CONS);			
						-- End Check whether this budget code is already utilized in this block ...!!!
	
      SELECT cbb.AMOUNT
      INTO  bud_amt
			FROM  CONSUMED_BUDGET_BALANCES cbb
     			 ,BUDGET_LINES_ALL         bla
			WHERE cbb.BL_ID    = bla.BL_ID
			AND   bla.BH_CC_ID = :RFN_LINES_ALL.BH_CC_ID
			AND   bla.TYPE     = :RFN_HEADERS_ALL.BUDGET_TYPE
			AND   bla.INACTIVE_F is null;
			
			rem_amt := (bud_amt - nvl(block_cons,0));

			IF REM_AMT - :RFN_LINES_ALL.FUNC_AMOUNT < 0 THEN
				--set_alert_property ('TRX_AMOUNT', alert_message_text, :RFN_LINES_ALL.BUDGET_CODE || ' has '|| rem_amt || '/-- Rs. remaining !' );
				--alrt := show_alert ('TRX_AMOUNT');
				FND_MESSAGE.DEBUG(:RFN_LINES_ALL.BUDGET_CODE || ' has ' || rem_amt || '/- Rs. remaining !');
				RAISE FORM_TRIGGER_FAILURE;
			ELSE
				vTimer := create_timer('NEXT_REC', 100, NO_REPEAT);
			END IF;			

	END IF;
END IF;
exception
	when form_trigger_failure then 
		raise form_trigger_failure;
END;
Re: issue with form trigger failure [message #599836 is a reply to message #599833] Tue, 29 October 2013 05:54 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
You can't use a timer for validation, it never works properly.
So ditch the timers and calculate the amount as the records are entered as I suggested earlier.
Re: issue with form trigger failure [message #599840 is a reply to message #599836] Tue, 29 October 2013 06:29 Go to previous messageGo to next message
m_shehpar
Messages: 73
Registered: October 2010
Location: Pakistan
Member
correct me if i am wrong bro... timer is the only way to use restricted built-ins while in when-validate_item triggers....

below is the code which i have written in the when-timer-expire popping up from validate item trigger. there is no other way i could ensure the budget amount consumed and the un-saved lines at the block corresponding to a certain budget

	IF vcTimer = 'CALC_REM_AMT' THEN
		  CURR_REC := TO_NUMBER(:SYSTEM.TRIGGER_RECORD);
		  FIRST_RECORD;
		  
		  LOOP
		  	IF :RFN_LINES_ALL.BH_CC_ID = TO_NUMBER(:GLOBAL.BUD_ID) AND :SYSTEM.RECORD_STATUS IN ('INSERT','NEW') THEN
		  			CONSUMED_AMT := CONSUMED_AMT + :RFN_LINES_ALL.FUNC_AMOUNT;
  					--ELSIF :SYSTEM.RECORD_STATUS = 'CHANGED' AND ( :GLOBAL.OLD_FUNC_AMT )			FOR EACH 'CHANGED' RECORD, VALIDATION IS ALREADY ENSURED :-)
		  	END IF;
		  	EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
  			NEXT_RECORD;
		  END LOOP;

		  GO_RECORD(CURR_REC);
		  :GLOBAL.BLK_CONS := ( CONSUMED_AMT - :RFN_LINES_ALL.FUNC_AMOUNT );	-- current line shouldn't be computed as already consumed !; 
		  

	ELSIF vcTimer = 'NEXT_REC' THEN
	........
Re: issue with form trigger failure [message #599845 is a reply to message #599840] Tue, 29 October 2013 06:37 Go to previous message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
m_shehpar wrote on Tue, 29 October 2013 11:29
correct me if i am wrong bro... timer is the only way to use restricted built-ins while in when-validate_item triggers....

Of course it is (or there isn't a way at all since it never works properly), which is why I'm telling you to calculate the amount as each record is entered, rather than trying to loop over them when doing the validation.
Previous Topic: Reading data from excel file and load into forms
Next Topic: path to the used dll
Goto Forum:
  


Current Time: Thu Mar 28 08:02:30 CDT 2024