Wednesday, December 13, 2017

APEX Interactive Report Checkbox Row Selection

APEX Interactive Report Checkbox Row Selection




Back in page designer click the Employees > Attributes in the rendering tree. Set Link Column to Exclude Link Column. Set Maximum Rows Per Page to 5 to make it easier to test that selection works across pages.
Add the page item that will hold the list of selected employees. Its value will be a string of bar (|) separated EMPNO values. From the item gallery drag a hidden item to the Employees region. Notice that the hidden item is not shown. This is to be expected because hidden items don’t take up any space in the layout grid. Look in the rendering tree and you will see it there. Select it and change the name to P1_SELECTED. Then add P1_SELECTED to the Interactive Report Page Items to Submit.
Next change the Interactive Report SQL Query to include a selected column. This will be used to determine if the checkbox should be checked initially.
select EMPNO,
    case when instr(:P1_SELECTED, '|' || EMPNO || '|') > 0 then 
      'checked' 
    else 
      '' 
    end as selected,
    ENAME,
    JOB,
    MGR,
    HIREDATE,
    SAL,
    COMM,
    DEPTNO
  from EMP
Expand the Columns node in the rendering tree and select the SELECTED column. Set the Type to Hidden Column.
We will use the EMPNO column as the checkbox column. Select it in the rendering tree. For the Heading property enter:

<input type="checkbox" value="all">
Set the Column Alignment to center. For the HTML Expression property enter:

<input type="checkbox" #SELECTED# value="#FILE_ID#" name="f40" id="f40_#FILE_ID#">


Create a Page Processing process with the following settings:
  • Type: PL/SQL
  • Name: Set ADMIN_USER flag
  • Sequence: 0 (Important: Has to be before all other processes)
  • Point: On Submit – Before Computation and Validations
  • Enter PL/SQL Page Process:
    BEGIN
        -- Reset the hidden ADMIN_USER flag for all visible records to N
        -- Note: g_f04 maps to the hidden ADMIN_USER column
       
    
        -- Set the hidden ADMIN_USER flag for those records where the
        -- checkbox has been set by the user to Y
       
        FOR ii IN 1 .. APEX_Application.g_f40.COUNT
        LOOP
            APEX_Application.g_f40(ii);
        END LOOP;
    END;


more
http://hardlikesoftware.com/weblog/2015/07/24/apex-interactive-report-checkbox-row-selection/
http://www.inside-oracle-apex.com/checkboxes-in-tabular-forms-the-easy-way/

No comments:

Post a Comment

AWS how to delete VPC when it has error with Network interface , Gateway decencies

   how to delete VPC when it has error with Network interface , Gateway decencies  in AWS 1. Check if it is running on EC2 instance then Sto...