Report with Form create Same Page

 


Step: 1
=====

Create IR Report And Entry Form Same Page.

Step: 2
=====

Select Entry Form.

Appearance :
   Template :
Inline Dialog

Step: 3
=====

Create Button. (New Entry)

Dynamic Action: 
   Name : 
New_Department_entry
   Event : Click
True Action : Execute JavaScript Code
Code : javascript:openModal('Show_Dept');

Again True Action: Clear
Affected Elements: Items
Items: P9_DEPARTMENT_ID,P9_DEPARTMENT_NAME

Step: 4
=====

Select Entry Form.

Static ID : Show_Dept


================================

Step: 5
=====

IR Report Query :

select  A.DEPARTMENT_ID,  --A.DEPARTMENT_NAME,

'<a href="'||'javascript:pageItem1(' || APEX_ESCAPE.JS_LITERAL (A.DEPARTMENT_ID) || ')">

<span class="edit-action" style="font-size: 13px;font-weight: 500;color: blue;">'||A.DEPARTMENT_NAME||'</span></a>' AS DEPARTMENT_NAME,

NVL(B.QTY,0) QTY

FROM  Table_name;


Step: 6
=====


Create Page Item : P9_DEPT_ID


Function and Global Variable Declaration :

function pageItem1(DEPT_ID){$s('P9_DEPT_ID', DEPT_ID)}


Step: 7
=====

Create Dynamic Action on P9_DEPT_ID

Execute JavaScript Code :

javascript:openModal('Show_Dept');


Select Entry Form.
Static ID : Show_Dept


Again Dynamic Action on P9_DEPT_ID (for Value Show)

Execute Server-side Code :

DECLARE
   CURSOR c_get_val (c_val IN VARCHAR2)
   IS
Select * -- DEPARTMENT_ID, DEPARTMENT_NAME    
FROM DEPARTMENTS
WHERE DEPARTMENT_ID=:P9_DEPT_ID;

   l_emp_rec   DEPARTMENTS%ROWTYPE;
BEGIN
   OPEN c_get_val (c_val => :P9_DEPT_ID);

   FETCH c_get_val INTO l_emp_rec;

   CLOSE c_get_val;

:P9_DEPARTMENT_ID := l_emp_rec.DEPARTMENT_ID  ;
:P9_DEPARTMENT_NAME := l_emp_rec.DEPARTMENT_NAME  ;

END;


===== or ======

Action Set Value : SQL Code :

Select  DEPARTMENT_ID, DEPARTMENT_NAME    
FROM DEPARTMENTS
WHERE DEPARTMENT_ID=:P9_DEPT_ID;


Notes: You Can Not Default Save Process.

Save/update Process:

UPDATE DEPARTMENTS SET
DEPARTMENT_NAME=:P9_DEPARTMENT_NAME,
UPDATE_BY=:APP_USER,
UPDATE_DATE=SYSDATE
WHERE DEPARTMENT_ID=:P9_DEPARTMENT_ID;
IF SQL%NOTFOUND THEN 
   SELECT NVL(MAX(DEPARTMENT_ID),10)+10 INTO :P9_DEPARTMENT_ID FROM DEPARTMENTS;
   INSERT INTO DEPARTMENTS (DEPARTMENT_ID,DEPARTMENT_NAME,ENTRY_BY, ENTRY_DATE)
   VALUES       (:P9_DEPARTMENT_ID,:P9_DEPARTMENT_NAME,:APP_USER,SYSDATE);
END IF;
  apex_application.g_print_success_message := '<span>'||:P9_DEPARTMENT_NAME ||' '|| 'Department is successfully save.'||'</span>';

Post a Comment

Previous Post Next Post