issue with form trigger failure [message #599637] |
Sun, 27 October 2013 08:54 |
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 #599687 is a reply to message #599641] |
Mon, 28 October 2013 04:36 |
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 |
cookiemonster
Messages: 13963 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 |
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 #599703 is a reply to message #599699] |
Mon, 28 October 2013 05:36 |
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 #599709 is a reply to message #599704] |
Mon, 28 October 2013 05:57 |
cookiemonster
Messages: 13963 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 |
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 #599840 is a reply to message #599836] |
Tue, 29 October 2013 06:29 |
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 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
m_shehpar wrote on Tue, 29 October 2013 11:29correct 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.
|
|
|