0
votes

Is it possible to create a radio button field or a checkbox field for each row of an interactive report?

If the above is possible, submit that selected row which would take the user to another report combining different tables?

Please explain how this is possible?

Many thanks

1

1 Answers

1
votes

You can create items using apex_item if you want to create a check box you will need to use:

APEX_ITEM.CHECKBOX2( p_idx                       IN    NUMBER
                   , p_value                     IN    VARCHAR2 DEFAULT NULL
                   , p_attributes                IN    VARCHAR2 DEFAULT NULL
                   , p_checked_values            IN    VARCHAR2 DEFAULT NULL
                   , p_checked_values_delimiter  IN    VARCHAR2 DEFAULT ':'
                   , p_item_id                   IN    VARCHAR2 DEFAULT NULL
                   , p_item_label                IN    VARCHAR2 DEFAULT NULL)
 RETURN VARCHAR2;

as you can see multiple examples in here if you want an IR with a custom checkbox you can do it this way:

SELECT APEX_ITEM.CHECKBOX2(1,empno) "Select"
,      ename
,      job
FROM   emp
ORDER  by 1

If I understand correctly after the user select any number of check boxes he can click on a button to show another report where you will need the selected check boxes. One way to achieve this is:

  1. Create a process to add the selected check boxes to a collection

    BEGIN
        apex_collection.create_or_truncate_collection(p_collection_name => 'col_tmp');
    
        FOR I in 1..APEX_APPLICATION.G_F01.COUNT
        LOOP  
            apex_collection.add_member( p_collection_name => 'col_tmp'
                                  , p_c001            => APEX_APPLICATION.G_F01(i));                
        END LOOP;
    END;
    
  2. Create a branch to the page with the other report. In this page you can use the collection in your select in order to show the right information:

    SELECT e.ename
    ,      e.job
    ,      d.dname
      FROM EMP e,
           DEPT d
     WHERE e.deptno = d.deptno
       AND empno IN (SELECT C001
                       FROM apex_collections
                      WHERE collection_name = 'COL_TMP')
    

NOTE: In the select you must use the collection name in upper case.