Home » Developer & Programmer » Forms » Unable to put a check for a form (Oracle 10g, Win XP.)
Unable to put a check for a form [message #463926] Mon, 05 July 2010 04:41 Go to next message
sreejith.s
Messages: 26
Registered: November 2009
Junior Member
Hi All,

I have a leave form where I need to put a check which prevents the user from entering 'sick leave' if the employee hasn't completed 3 months in the company.

This is the code I've written:

SELECT ABS(MONTHS_BETWEEN(t.start_date,sysdate)) INTO l_date
FROM hrp_per_all_people_f t
WHERE t.company_id = :parameter.p_company_id
AND t.employee_number = :parameter.p_employee_number
AND t.effective_end_date = '31-dec-4712';

IF :hrp_per_absence_assignment.absence_type_id = 21 THEN
IF l_date < 3 THEN
aid := Find_Alert('COMMON ALERT');
SET_ALERT_PROPERTY(aid, alert_message_text, 'This employee has not completed three months and is not eligible for sick leave' );
alert_id := SHOW_ALERT( aid );
RAISE FORM_TRIGGER_FAILURE;
END IF;
END IF;

The absence_type_id = 21 is for 'sick leave'. I can't figure out why this is not working. When I do enter 'sick leave' for a new employee I do not get any checks and neither am I able to save the changes.

Kindly help.

Regards,
Sreejith
Re: Unable to put a check for a form [message #463931 is a reply to message #463926] Mon, 05 July 2010 05:11 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
What trigger is the code in?
Have you put a message in to check the value of l_date? if you haven't, do so.
Re: Unable to put a check for a form [message #463936 is a reply to message #463926] Mon, 05 July 2010 05:34 Go to previous messageGo to next message
sreejith.s
Messages: 26
Registered: November 2009
Junior Member
Hi,

The code is in a procedure body that has other similar codes for different types of leave entries.
How do you go about putting that message?

Regards,
Sreejith
Re: Unable to put a check for a form [message #463943 is a reply to message #463936] Mon, 05 July 2010 06:00 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
And which trigger is the procedure called from?
Look up the message built-in in form builder help.
Re: Unable to put a check for a form [message #463944 is a reply to message #463943] Mon, 05 July 2010 06:15 Go to previous messageGo to next message
sreejith.s
Messages: 26
Registered: November 2009
Junior Member
Hi,

The procedure is called from the Pre-Insert trigger.

Regards,
Sreejith
Re: Unable to put a check for a form [message #463947 is a reply to message #463944] Mon, 05 July 2010 06:21 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
OK, so now use a message to find out the value of l_date.
Re: Unable to put a check for a form [message #465214 is a reply to message #463947] Tue, 13 July 2010 03:56 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Do all validations in the 'when-validate-item' trigger.

David
Previous Topic: How To Get Webuser in a Forms 11g.
Next Topic: how to implement custom lov button without the standard template.fmb?
Goto Forum:
  


Current Time: Fri Sep 20 09:34:19 CDT 2024