FORM界面批量处理-全选框实现

原创 2013年12月04日 22:39:46

全选框实现方法多种多样,这里只介绍两种

方法一:触发器式,优点程序简单,缺点颜色单调不突出

1.      在数据块和控制块上分别创建check box

2.      设置check box选中与为选中的值 Y/N和初始值

3.  

在数据块check box下触发器WHEN-CHECKBOX-CHANGED中调用程序

PROCEDURE check_box IS
    BEGIN
        IF :HEADER.check_box = 'Y' THEN
            --:HEADER.count := 1;
            NULL;--特殊用途,可选
        ELSE
            --:HEADER.count := 0;
             NULL;
        END IF;
END check_box;


4.      在数据块下建立BLOCK级触发器CHECK_ALL_RECORDS调用程序

PROCEDURE check_all_records IS
BEGIN
  --fnd_message.debug('PACKAGE BODY headers IS PROCEDURE check_all_records IS');
  IF :control.check_header_all = 'Y' THEN
    IF :header.check_box = 'N' OR :header.check_box IS NULL THEN
      :header.check_box := 'Y';
      --  :line.count     := 1;
    END IF;
  ELSE
    IF :header.check_box = 'Y' THEN
      :header.check_box := 'N';
      -- :line.count     := 0;
    END IF;
  END IF;

  --fnd_message.debug('PACKAGE BODY headers IS PROCEDURE check_all_records IS');

END check_all_records;


 

5.      在控制块下的check box CHECK_HEADER_ALL下建立触发器WHEN-CHECKBOX-CHANGED调用程序

 

PROCEDURE check_header_all IS
    BEGIN
    
    	  app_record.for_all_records('HEADER', 'CHECK_ALL_RECORDS');
END check_header_all;

 

6.      在需要处理的地方循环判断处理

 

PROCEDURE apply IS
v_count number;
v_line_num number;
BEGIN
  go_block('HEADER'); --跳到目的数据
  first_record; --从第一条记录开始循环
  LOOP
    
    IF :header.check_box = 'Y' THEN
    v_count := v_count + 1;
    --fnd_message.debug('循环处理次数');
     AP_INVOICE_LINES_ALL_PRIVATE.INSERT_ROW (X_LINE_NUM =>v_line_num,
     																					P_FLAG =>'APPLY',
     																					P_AMOUNT =>:header.AMOUNT);
     
     AP_DISTRIBUTIONS_PRIVATE.INSERT_ROW (P_LINE_NUM =>v_line_num,
     																			P_FLAG =>'APPLY',
     																			P_AMOUNT =>:header.AMOUNT,
     																			P_INVOICE_ID => :parameter.G_INVOICE_ID);
     
     LINE_PRIVATE.insert_row (P_LINE_NUM =>v_line_num,P_FLAG =>'APPLY');
      -- :line.CURRENT_RECORD_INDICATOR := 'Y'; --将指定行的复选框设置为选中
      --  BATCH_PROCESSING. EVENT('WHEN-MOUSE-CLICK', 'LINE');
      DOCOMMIT;
    END IF;
  
    EXIT WHEN :system.last_record = 'TRUE';
  
    next_record;
  
    END LOOP;
    --fnd_message.debug('循环处理次数-----');
  --commit;
  DOCOMMIT;
  first_record;
  go_block('HEADER');
  
    :parameter.g_query_find := 'TRUE';
    app_find.find('HEADER');
    :parameter.g_query_find := 'FALSE';
END apply;

方法二:选中与未选中颜色不同,显示多样

  1. 在需要进行批量操作的数据块中,对于item——current_record_indicator将其项类型改为‘“复选框”。
  2. 包app_multi在库appcore中,确保有该库
  3. 根据以下列表创建trigger

 

S. No

Trigger Level

Trigger Name

Standard Library Call

Form

KEY-CLRFRM

App_multi.event(‘KEY-CLRFRM’)

Block

WHEN-MOUSE-CLICK

App_multi.event(‘WHEN-MOUSE-CLICK’)

Block

WHEN-NEW-RECORD-INSTANCE

App_multi.event(‘WHEN-NEW-RECORD-INSTANCE’)

Block

KEY-CREREC

App_multi.event(‘KEY-CREREC’)

Block

WHEN-CLEAR-BLOCK

App_multi.event(‘WHEN-CLEAR-BLOCK’)

Block

PRE-BLOCK

App_multi.event(‘PRE-BLOCK’)

Block

POST-BLOCK

App_multi.event(‘POST-BLOCK’)

Block

KEY-DELREC

App_multi.event(‘KEY-DELREC’)

Block

KEY-CLRREC

App_multi.event(‘KEY-CLRREC’)

Block

DESELECT_ALL*

App_multi.event(‘DESELECT_ALL’)

Block

SELECT_ALL*

App_multi.event(‘SELECT_ALL’)

*Note – The triggers are user defined triggers

 

 

  1. 在form级别下添加MULTI_RETURN_ACTION自定义trigger

 

DECLARE
action VARCHAR2(64);
blockname VARCHAR2(30);
rec_count VARCHAR2(3);
BEGIN
     blockname := :GLOBAL.APPCORE_MULTI_BLOCK;
     action := :GLOBAL.APPCORE_MULTI_ACTION;


IF blockname = 'FORM-LEVEL' THEN
     IF action = 'KEY-CLRFRM' THEN
          NULL;
     END IF;


     ELSIF blockname = 'TRN_ORD_HEADERS_V_SUM' THEN
          IF action = 'LABEL_CHANGE' THEN
               NULL;
          ELSIF action = 'PRE-KEY-DELREC' THEN
               fnd_message.set_name('FND', 'MULTI_DELETE_RECORD');
               rec_count := TO_CHAR( app_multi.
               get_group_count('TRN_ORD_HEADERS_V_SUM'));
               fnd_message.set_token('NUM_OF_RECS', rec_count);
               IF (not fnd_message.warn) THEN
                    RAISE form_trigger_failure;
               END IF;
          ELSIF action = 'KEY-DELREC' THEN
               delete_record;
               IF NOT(FORM_SUCCESS) THEN
                    RAISE form_trigger_failure;
               END IF;
          ELSIF action = 'KEY-CLRREC' THEN
               clear_record;
               IF NOT(FORM_SUCCESS) THEN
                    RAISE form_trigger_failure;
               END IF;
          ELSIF action = 'RECORD_DESELECTED' then
                    --fnd_message.debug('deselected');
                    null;
          ELSIF action = 'RECORD_SELECTED' then
                 --fnd_message.debug('selected');
                 null;
          END IF;
ELSE
fnd_message.debug('There is no multi-select block '
|| blockname ||'. Action: '||action);
END IF;
END;


5.    创建过程event

PROCEDURE event(event_name VARCHAR2 DEFAULT 'WHEN-MOUSE-CLICK',
                  blockname  VARCHAR2 DEFAULT NULL) IS
    cursor_blk       VARCHAR2(30);
    cursor_blk_id    BLOCK;
    groupname        VARCHAR2(40);
    records_id       RECORDGROUP;
    rec_num_col_id   GROUPCOLUMN;
    anchors_id       RECORDGROUP;
    block_col_id     GROUPCOLUMN;
    anchor_col_id    GROUPCOLUMN;
    added_rec_col_id GROUPCOLUMN;
    prev_wnri_col_id GROUPCOLUMN;
    wnri_col_id      GROUPCOLUMN;
    anchors_row      INTEGER;
    new_rec          INTEGER;
    new_item         VARCHAR2(60);
    rec_count        INTEGER;
    modifier         VARCHAR2(30);
    rec_num          INTEGER;
    anchor           INTEGER;
    i        INTEGER;
    added_rec        INTEGER;
    trig_block       VARCHAR2(30);
    q_hits           INTEGER;
    multi_block      VARCHAR2(30);
  begin
    COPY('Entering app_multi.event. Event is '||event_name||'.','global.frd_debug');
    anchors_id := find_group('anchors');
    if event_name in ('KEY-CLRFRM') then
      --
      -- This is the only form-level event
      --
      if not(id_null(anchors_id)) then
        rec_count := get_group_row_count(anchors_id);
        for anchors_row in 1..rec_count LOOP
          groupname := get_group_char_cell('anchors.groupname', anchors_row);
          delete_group_row(groupname, ALL_ROWS);
          set_group_number_cell('anchors.anchor', anchors_row, 1);
          set_group_number_cell('anchors.added_rec', anchors_row, null);
          set_group_number_cell('anchors.previous_wnri_anchor', anchors_row, null);
          set_group_number_cell('anchors.wnri_anchor', anchors_row, null);
        end LOOP;
        app_multi_private.menu_refresh;
        --
        -- Developer must call app_standard.event('KEY-CLRFRM')
        --
        copy('FORM-LEVEL', 'GLOBAL.APPCORE_MULTI_BLOCK');
        copy('KEY-CLRFRM', 'GLOBAL.APPCORE_MULTI_ACTION');
        execute_trigger('MULTI_RETURN_ACTION');
      else
        app_standard.event('KEY-CLRFRM');
      end if;
    else
      --
      -- Initialize or find group and column id's
      --
      trig_block := name_in('SYSTEM.TRIGGER_BLOCK');
      multi_block := nvl(upper(blockname), trig_block);
      copy(multi_block, 'GLOBAL.APPCORE_MULTI_BLOCK');
      groupname := multi_block||'_MULTI';

      records_id := find_group(groupname);
      if id_null(records_id) then
        records_id := create_group(groupname);
        rec_num_col_id := add_group_column(records_id, 'rec_num', NUMBER_COLUMN);
      else
        rec_num_col_id := find_column(groupname||'.rec_num');
      end if;
      --
      -- Store the select anchor in another group (use a record
      -- group to make the group specific to the form)
      --
      if id_null(anchors_id) then
        anchors_id := create_group('anchors');
        block_col_id := add_group_column(anchors_id, 'groupname', CHAR_COLUMN, 30);
        anchor_col_id := add_group_column(anchors_id, 'anchor', NUMBER_COLUMN);
        added_rec_col_id := add_group_column(anchors_id, 'added_rec', NUMBER_COLUMN);
        prev_wnri_col_id := add_group_column(anchors_id, 'previous_wnri_anchor', NUMBER_COLUMN);
        wnri_col_id := add_group_column(anchors_id, 'wnri_anchor', NUMBER_COLUMN);
        add_group_row(anchors_id, 1);
        anchors_row := 1;
        set_group_char_cell(block_col_id, anchors_row, groupname);
        set_group_number_cell(anchor_col_id, anchors_row, 1);
        set_group_number_cell(prev_wnri_col_id, anchors_row, null);
        set_group_number_cell(wnri_col_id, anchors_row, null);
      else
        block_col_id := find_column('anchors.groupname');
        anchor_col_id := find_column('anchors.anchor');
        prev_wnri_col_id := find_column('anchors.previous_wnri_anchor');
        wnri_col_id := find_column('anchors.wnri_anchor');
        anchors_row := get_group_record_number(block_col_id, groupname);
        if anchors_row = 0 then
          anchors_row := get_group_row_count(anchors_id) + 1;
          add_group_row(anchors_id, anchors_row);
          set_group_char_cell(block_col_id, anchors_row, groupname);
          set_group_number_cell(anchor_col_id, anchors_row, 1);
          set_group_number_cell(prev_wnri_col_id, anchors_row, null);
          set_group_number_cell(wnri_col_id, anchors_row, null);
        end if;
      end if;

      cursor_blk := upper(nvl(blockname,name_in('SYSTEM.CURSOR_BLOCK')));
      cursor_blk_id := find_block(cursor_blk);
      if not id_null(cursor_blk_id) then
        new_rec := get_block_property(cursor_blk_id, CURRENT_RECORD);
      else
        new_rec := name_in('SYSTEM.CURSOR_RECORD');
        cursor_blk := name_in('SYSTEM.CURSOR_BLOCK');
      end if;

      if event_name like 'WHEN-MOUSE-CLICK%' then
        if get_item_property(name_in('SYSTEM.TRIGGER_ITEM'), ITEM_TYPE) = 'BUTTON' then
          COPY('Completed app_multi.event. Event is '||event_name||
               '.  Return from procedure, item type is button','global.frd_debug');
          RETURN;
        end if;
        --
        -- System.mouse_button_modifiers will contain a string like
        -- 'Shift+Control+' - should be platform/language-independent.
        --
        modifier := name_in('SYSTEM.MOUSE_BUTTON_MODIFIERS');
        --
        -- In the case of Shift+Control+ we act like it's just Shift-
        --
        if ( instr(modifier, 'Shift') <> 0 ) then
                         null;
        elsif 1=1 then
          if get_record_property(new_rec, cursor_blk, status) <> 'NEW' then
      -- Determine the state of the current rec
      rec_num := get_group_record_number(rec_num_col_id, new_rec);
      if rec_num = 0 then
        app_multi_private.select_records(records_id, rec_num_col_id, new_rec);
      else
        app_record.highlight('');
        delete_group_row(records_id, rec_num);
              copy('RECORD_DESELECTED', 'GLOBAL.APPCORE_MULTI_ACTION');
              execute_trigger('MULTI_RETURN_ACTION');
        app_multi_private.menu_refresh;
        copy('LABEL_CHANGE', 'GLOBAL.APPCORE_MULTI_ACTION');
        execute_trigger('MULTI_RETURN_ACTION');
        set_group_number_cell(anchor_col_id, anchors_row,new_rec);
      end if;
    end if;

        else -- No modifier key
          if get_group_number_cell(anchor_col_id, anchors_row) <> new_rec then
            app_multi_private.deselect_all(records_id, rec_num_col_id);
          end if;
        end if;
        set_group_number_cell(anchor_col_id, anchors_row, new_rec);
        set_group_number_cell(prev_wnri_col_id, anchors_row, null);

      elsif event_name = 'WHEN-NEW-RECORD-INSTANCE' then
        set_group_number_cell(prev_wnri_col_id, anchors_row,
                              get_group_number_cell(wnri_col_id, anchors_row));
        set_group_number_cell(wnri_col_id, anchors_row, new_rec);
      elsif event_name = 'KEY-CREREC' then
        app_multi_private.deselect_all(records_id, rec_num_col_id);
        -- Developer must call create_record;
      elsif event_name = 'WHEN-CLEAR-BLOCK' then
        app_multi.clear_group(multi_block);
      --elsif event_name = 'KEY-F2' then
      --  app_multi.event('WHEN-MOUSE-CLICK.Shift+',blockname);
      --elsif event_name = 'KEY-F3' then
      --  app_multi.event('WHEN-MOUSE-CLICK.Control+',blockname);
      elsif event_name = 'DESELECT_ALL' then
        app_multi_private.deselect_all(records_id, rec_num_col_id);
      elsif event_name = 'SELECT_ALL' then
        app_multi_private.select_all(records_id, rec_num_col_id);
      elsif event_name in ('POST-BLOCK', 'PRE-BLOCK') then
        app_multi_private.menu_refresh(event_name);
      elsif event_name in ('KEY-DELREC', 'KEY-CLRREC') then
        app_multi_private.action(records_id, event_name, multi_block);
        app_multi.clear_group(multi_block);
      else
        app_multi_private.action(records_id, event_name,
                                 nvl(blockname, cursor_blk));
      end if;
    end if;
    COPY('Completed app_multi.event. Event is '||event_name||'.','global.frd_debug');
  EXCEPTION
    WHEN OTHERS THEN
      set_application_property(CURSOR_STYLE, 'DEFAULT');
  END event;


6.创建函数get_group_count

FUNCTION get_group_count(blockname VARCHAR2)
    RETURN NUMBER IS
    groupid   RECORDGROUP;
    rec_count INTEGER;
  BEGIN
    COPY('Entering app_multi.get_group_count.','global.frd_debug');
    groupid := find_group(blockname||'_MULTI');
    if id_null(groupid) then
      fnd_message.debug('DEVELOPER ERROR: Invalid blockname '||blockname
        ||' in app_multi.get_group_count');
    end if;
    rec_count := get_group_row_count(groupid);
    if rec_count = 0 then
      --COPY('Completed app_multi.get_group_count.  RETURN 1.','global.frd_debug');
      return 0;
    else
      COPY('Completed app_multi.get_group_count.RETURN rec_count.','global.frd_debug');
      return rec_count;
    end if;
  END get_group_count;


7.在要进行批量操作的数据块下的current_record_indicator添加when-checkbox-changed

    调用过程event

 

8.创建按钮,添加按钮的when-button-pressed

DECLARE
     l_num_group_count NUMBER;
  l_grp_group_col_id GROUPCOLUMN;
  l_num_rec_num NUMBER;
  l_chr_current_block VARCHAR2(80);


  --l_num_hike_percent NUMBER;
BEGIN
  l_chr_Current_Block := :GLOBAL.APPCORE_MULTI_BLOCK;
  GO_BLOCK(l_chr_Current_Block);
  l_num_group_count  := Get_Group_Count(l_chr_Current_Block);
 -- fnd_message.debug('count=' || l_num_group_count);
  if l_num_group_count > 0 then
       l_grp_Group_Col_Id := App_Multi.Get_Group_Col(l_chr_Current_Block);

     For i IN 1..l_num_group_count
          LOOP
               l_num_Rec_Num := Get_Group_Number_Cell(l_grp_Group_Col_Id,i);
                        GO_RECORD(l_num_Rec_Num);
                        fnd_message.debug('--' || name_in(l_chr_Current_Block||'.order_number')); 
                         --在这里循环选中的record,对其进行自己的逻辑
                                   --     Copy (TO_CHAR(TO_NUMBER(name_in(l_chr_Current_Block || ‘.SALARY’) * (1 + l_num_hike_percent ))), l_chr_Current_Block || ‘.SALARY’);
          END LOOP;
    end if;
EXCEPTION
WHEN invalid_number THEN
     Fnd_message.debug ('Invalid Number format exception: Please Check the name of the button. The format is HIKE_PERCENT_<percentage>');
END;


版权声明:本文为博主原创文章,未经博主允许不得转载。 举报

相关文章推荐

Form中实现Checkbox全选反选

go_block('BLOCKNAME'); --跳到目的数据块 first_record; --从第一条记录开始循环 LOOP if :BLOCK116.check_all = 'Y' t...
  • ygj26
  • ygj26
  • 2012-08-22 10:25
  • 3391

表单中全选与全不选在同一个按钮【简单】

在表单中想对一些行进行操作。可单选,多选,全选,全不选等按钮进行操作。 全选与全不选在同一个按钮上。 总选按钮:子选按钮:" />js:$(document).on("click", "....

我是如何成为一名python大咖的?

人生苦短,都说必须python,那么我分享下我是如何从小白成为Python资深开发者的吧。2014年我大学刚毕业..

BI Publisher(rtf)模板开发语法大全

Rtf模板开发例如背景,纹理分栏等等功能都能用word工具实现不再具体总结大家可以参考word教程。。。。。   一.组 定义一个组的目的是告诉XMLPublisher 对重复的数据行进行循环显示,也...

两种方法 更改 EBS R12界面LOGO以及内容

EBSR12更改界面LOGO以及内容 1.      登录界面左上角oracleLOGO图片 为GIF格式,大小155*20  背景透明。文件名为:FNDSSCORP.gif 目录为:/d01...

Oracle EBS R12文件系统结构

Oracle EBS R12文件系统结构   Oracle EBS R12在服务器端文件结构如下: 顶层目录下面分为 1)inst ——–跟ebs整个实例(instance)相关的配置信息...

更改EBS R12中forms的模式Servlet/Socket

EBS R12中forms的模式有:Servlet mode 和 Forms Socket mode       当我们完成Oracle EBS R12套件的快速安装后,forms的默认配置是S...

修改ebs form socket模式

最近有个项目需要用loadrunner做压力测试,让我帮忙修改form socket模式。在此记录一下大致步骤 修改socket模式,大多觉得很容易,一个脚本的事情。其实就是这样,但是为了loadru...

Oracle Ebs R12 SLA与GL关系变化

转自:http://www.cnblogs.com/bruce_zhao/p/3809886.html Oracle Ebs R12 SLA与GL关系变化 SLA概念:SLA(Subled...

Oracle Form开发书籍推荐

深入浅出的完整介绍form开发,包括所以基础知识以及复杂功能,设计等等,包含众多实例,原理分析,开发规范,常用代码,技巧等等。Oracle application DBA或者开发必备。

【jQuery】复选框的批量处理:全选、非全选

最近工作都在写jQuery,事实上我并没有系统学过js,今天跟大家分享一下最近写的一个有关复选框的批量处理。 测试 全选 城市 ...
  • LZGS_4
  • LZGS_4
  • 2015-07-27 00:24
  • 1700
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)