Control Item help [message #238722] |
Sat, 19 May 2007 13:15 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
lune
Messages: 27 Registered: August 2006 Location: UAE
|
Junior Member |
|
|
I have created a control item to show the department name in the employee form instead of showing the department ID
The problem is when I want to insert a new employee record I want the user to choose the department name and according the chosen department name the department ID will be inserted in the employee table for the new employee.
Do you have anyway to do it?
I tried to write this code in the insert button but it didn’t work ???
DECLARE
DEPT_NO DEPARTMENTS.DEPT_ID%TYPE;
BEGIN
SELECT DEPARTMENTS.DEPT_ID INTO DEPT_NO
FROM DEPARTMENTS
WHERE DEPARTMENT_NAME = :EMPLOYEES.DEPT_NAME;
FORMS_DDL('INSERT INTO DNRD_EMPLOYEES VALUES (:EMPLOYEES.EMP_ID, DEPT_NO, EMPLOYEES.EMP_NAME, EMPLOYEES.EMP_EMAIL)');
COMMIT;
message('The record has been inserted successfully');
END;
Waiting your help
|
|
|
|
Re: Control Item help [message #238786 is a reply to message #238722] |
Sun, 20 May 2007 00:14 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
lune
Messages: 27 Registered: August 2006 Location: UAE
|
Junior Member |
|
|
Thank you for your reply LittleFoot
I did it in another way, I created a list item on the department ID showing the department name and department ID as a value.
But I'm getting this error
FRM-40202 fields must be enterd
----
lune
|
|
|
|
Re: Control Item help [message #239287 is a reply to message #238722] |
Mon, 21 May 2007 23:08 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
lune
Messages: 27 Registered: August 2006 Location: UAE
|
Junior Member |
|
|
Hello LittleFoot
I have created a record group for the list but the same error is appearing FRM-40202 fields must be enterd
Here is the code and Im not leaving any record empty
DECLARE
INSERT_MESSAGE NUMBER;
BEGIN
IF (:EMPLOYEES.DEPARTMENT_DEPT_ID IS NULL OR :EMPLOYEES.EMP_NAME IS NULL OR :EMPLOYEES.EMP_NO IS NULL OR :EMPLOYEES.EMP_EMAIL IS NULL) THEN
SET_ALERT_PROPERTY('ERROR_ALERT',ALERT_MESSAGE_TEXT,'You must enter all the fields !!!');
SET_ALERT_PROPERTY('ERROR_ALERT',TITLE,'ERROR');
INSERT_MESSAGE := SHOW_ALERT('ERROR_ALERT');
raise form_trigger_failure;
END IF;
FORMS_DDL('INSERT INTO EMPLOYEES VALUES (:EMPLOYEES.EMP_ID, :EMPLOYEES.DEPARTMENT_DEPT_ID, :EMPLOYEES.EMP_NAME, :EMPLOYEES.EMP_NO, :EMPLOYEES.EMP_EMAIL)');
COMMIT;
SET_ALERT_PROPERTY('NOTE_ALERT',TITLE,'SAVE FORM');
SET_ALERT_PROPERTY('NOTE_ALERT',ALERT_MESSAGE_TEXT,'The record has been inserted successfully');
INSERT_MESSAGE:=SHOW_ALERT('NOTE_ALERT');
END;
But I dont why the message say it is empty when I try to show the department ID in an alert the right Id for the selected department name appear
DECLARE
INSERT_MESSAGE NUMBER;
BEGIN
IF (:EMPLOYEES.DEPARTMENT_DEPT_ID IS NULL OR :EMPLOYEES.EMP_NAME IS NULL OR :EMPLOYEES.EMP_NO IS NULL OR :EMPLOYEES.EMP_EMAIL IS NULL) THEN
SET_ALERT_PROPERTY('ERROR_ALERT',ALERT_MESSAGE_TEXT,'You must enter all the fields !!!');
SET_ALERT_PROPERTY('ERROR_ALERT',TITLE,'ERROR');
INSERT_MESSAGE := SHOW_ALERT('ERROR_ALERT');
raise form_trigger_failure;
END IF;
SET_ALERT_PROPERTY('ERROR_ALERT',ALERT_MESSAGE_TEXT,'You must enter all the fields !!!'||:EMPLOYEES.DEPARTMENT_DEPT_ID ||'');
SET_ALERT_PROPERTY('ERROR_ALERT',TITLE,'ERROR');
INSERT_MESSAGE := SHOW_ALERT('ERROR_ALERT');
FORMS_DDL('INSERT INTO EMPLOYEES VALUES (:EMPLOYEES.EMP_ID, :EMPLOYEES.DEPARTMENT_DEPT_ID, :EMPLOYEES.EMP_NAME, :EMPLOYEES.EMP_NO, :EMPLOYEES.EMP_EMAIL)');
COMMIT;
SET_ALERT_PROPERTY('NOTE_ALERT',TITLE,'SAVE FORM');
SET_ALERT_PROPERTY('NOTE_ALERT',ALERT_MESSAGE_TEXT,'The record has been inserted successfully');
INSERT_MESSAGE:=SHOW_ALERT('NOTE_ALERT');
END;
Waiting your help ![Sad](images/smiley_icons/icon_sad.gif)
lune
|
|
|
Re: Control Item help [message #239321 is a reply to message #239287] |
Tue, 22 May 2007 00:56 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
kamran.it
Messages: 265 Registered: September 2005 Location: Karachi
|
Senior Member |
|
|
If you have any button in this block then assign the button into new control_block (block which is not assoiated with database)
or
turn off the mouse navigate property of button.
|
|
|
Re: Control Item help [message #239342 is a reply to message #239321] |
Tue, 22 May 2007 01:30 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
lune
Messages: 27 Registered: August 2006 Location: UAE
|
Junior Member |
|
|
kamran.it
Thanks for your reply
I tried to turn off the mouse navigate property of button
but it didn't worked. the same error appeared again
Quote: |
If you have any button in this block then assign the button into new control_block (block which is not assoiated with database)
|
Didn't understand how to do it
waiting your help
Thanks
lune
|
|
|
|
Re: Control Item help [message #239387 is a reply to message #239355] |
Tue, 22 May 2007 04:27 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
lune
Messages: 27 Registered: August 2006 Location: UAE
|
Junior Member |
|
|
kamran.it
I tried your solution but it didnt work
I will send you the form so you can have a look at it
Thanks
lune
|
|
|