Thursday, January 11, 2024

Interactive Grid Get Selected Rows | Oracle APEX

 

  • Step - 1 : 

        Create Blank page

  • Step - 2 : 

        Create one page item        -----my page item is P7_DEPT_ID

  • Step - 3 : 

        Create region - Type is interactive grid, table name is dept

                                   Select the column primary key

                                   Click on attributes edit is on

 

 

 
  • Step - 4: 

            Create Dynamic Action for Interactive Grid

             When event-> Selection change (interactive grid)

                                        Selection Type: Region

                                        Region: dept

               Select the true action -> execute JavaScript


 

                 Code:

                        VAR i,  i_empids = ":", i_empid,

                        model = this.data.model;

                        FOR ( i = 0; i < this.data.selectedRecords.length; i++ ) {

                        i_empid = model.getValue( this.data.selectedRecords[i], "DEPT_ID");

                        i_empids += model.getValue( this.data.selectedRecords[i], "DEPT_ID") + ":";

                      }

                      apex.item( "P7_DEPT_ID" ).setValue (i_empids);

 

  •      Step - 5: 

              Create region - Type is interactive Report, table name is EMP


                 Change the interactive report query:

                SQL query: -

                       SELECT

                       FROM employee

                       WHERE (instr(':'|| :P7_DEPT_ID || ':',':'|| dept_id ||':') > 0 OR  :P7_DEPT_ID is null)

                    page items to submit :P7_DEPT_ID

 
  • Step - 6 : 

            Add the dynamic action for page item.

                Identification:  Action - refresh

               Affected Elements: Selection type - region

                                                Region - employee


 
  • Step - 7 : 

      Save and run the page.

Output:

 


       Selected dept name details displayed in employee report.


 

 

No comments:

Post a Comment