APP_FIELD设置Item运行时行为

1.APP_FIELD.SET_DEPENDENT_FIELD 建立相依字段,根据主Item控制子Item可输入或者不可输入
语法:APP_FIELD.SET_DEPENDENT_FIELD(EVENT,:block.master_item = CONDITION,'block.dependent_item');
用途:A conditionally-dependent item changes validation when the value in the master item changes. 
Specify the condition rather than the master item name.
This procedure makes an item enterable or not enterable based on whether the master item is NULL or a specified condition is TRUE, and clears the field. 
The dependent item can be a text item, check box, or poplist.
具体步骤:
a,pre-record的时候,最好要将所有的dependent field初始化。有的删除,一定需要的可以建立。
b,建立的Procedure最好要系统化,子程序化。使得相互之间可以调用。
c,通常在以下的trigger中调用Dependencies控制逻辑:
pre-record,when-create-record,when-validate-item,when-checkbox-changed,when-radio-changed,when-list-changed,post-query(当dependent item在列表型数据块才是必须的)和'init'事件
pre-record和init是在操作数据前初始化这些逻辑,而其他是在item发生变化后验证这些逻辑,满足条件则进行后续的动作。
需要注意的是,设置了dependent的关系的item,在其主变化时候,相依的item会自动清空。但是仅仅会清空相依的那一个字段。
如果相依的字段,还有自己相依的字段(比如Show值,但是存ID,或者Show值,另外还有描述等信息),如果想一起清空,要用:app_field.clear_dependent_fields
APP_FIELD.SET_DEPENDENT_FIELD(EVENT,(:block.master_item IS NOT NULL),'block.dependent_item');
用于Multiple items may depend on a single master.
APP_FIELD.SET_DEPENDENT_FIELD(EVENT,((:block.master_item1 IS NOT NULL) AND (:block.master_item2 IS NOT NULL)),'block.dependent_item');
用于Two master items may share a dependent item.
APP_FIELD.SET_DEPENDENT_FIELD(EVENT,'block.master_item','block.dependent_item');
用于Cascading dependence - an item can be both master and dependent.

APP_FIELD.set_dependent_field(event VARCHAR2, master_field VARCHAR2, dependent_field  VARCHAR2, invalidate BOOLEAN DEFAULT FALSE)
实现:如果master_field为空,则dependent_Field的ENTERABLE为PROPERTY_OFF;反之,如果master_field不空,则dependent_Field的ENTERABLE为PROPERTY_ON。
event可以为'..VALIDATE..','INIT','PRE-RECORD', 'WHEN-NEW-RECORD-INSTANCE','POST-QUERY'。这个Procedure其实调用了另外一个Procedure
APP_FIELD.set_dependent_field( event VARCHAR2, condition BOOLEAN, dependent_field  VARCHAR2,invalidate BOOLEAN DEFAULT FALSE)
条件condition为(name_in(master_field) is not null)

2.APP_FIELD.CLEAR_DEPENDENT_FIELDS 清除相依字段的数据
APP_FIELD.clear_dependent_fields(master_field VARCHAR2,
                                 field1       VARCHAR2,
                                 field2       VARCHAR2 DEFAULT NULL,
                                 field3       VARCHAR2 DEFAULT NULL,
                                 field4       VARCHAR2 DEFAULT NULL,
                                 field5       VARCHAR2 DEFAULT NULL,
                                 field6       VARCHAR2 DEFAULT NULL,
                                 field7       VARCHAR2 DEFAULT NULL,
                                 field8       VARCHAR2 DEFAULT NULL,
                                 field9       VARCHAR2 DEFAULT NULL,
                                 field10      VARCHAR2 DEFAULT NULL)

3.APP_FIELD.SET_EXCLUSIVE_FIELD 只需填一个Item即可,填后其他项不可输入
用途:Mutually exclusive items,they look like two items, but behave as one. Use APP_FIELD.SET_EXCLUSIVE_FIELD to code.
APP_FIELD.SET_EXCLUSIVE_FIELD(EVENT,’block.item1’,’block.item2’,’block.item3’);
Call item handler procedures in:
– WHEN-VALIDATE-ITEM for each exclusive item
– PRE-RECORD on the ‘items’ block (Fire in Enter-Query Mode: No)
– WHEN-CREATE-RECORD on the items’ block

4.APP_FIELD.SET_INCLUSIVE_FIELD 只要有不为空的item,则都为必填项
用途:Mutually Inclusive Items—one for all and all for one!
Use APP_FIELD.SET_INCLUSIVE_FIELD to code a set of items where, if any of the items is not null, all items are required.
APP_FIELD.SET_INCLUSIVE_FIELD(EVENT,’block.item1’,’block.item2’);
Call item handler procedures in:
– WHEN-VALIDATE-ITEM for each inclusive item
– PRE-RECORD on the ’items’ block (Fire in Enter-Query Mode: No)

5.APP_FIELD.SET_REQUIRED_FIELD
用途:Conditionally Mandatory items—use APP_FIELD.SET_REQUIRED_FIELD to require certain items only if a certain condition is met.
APP_FIELD.SET_REQUIRED_FIELD(EVENT,(CONDITION),’block.item’);

http://docs.oracle.com/cd/E18727_01/doc.121/e12897/T302934T457082.htm#I_fx2Ddepend

 

posted on 2015-04-20 16:40  小林子的烂笔头  阅读(540)  评论(0编辑  收藏  举报

导航