solomon_007 发表于 2011-9-19 14:06
trigger 当中不能加 commit.
要加的话,用自治事务 PRAGMA AUTONOMOUS_TRANSACTION
请问下,
1. 有一个form,是列表展现形式的;
假设有 column A , B , C
现在想将 B, C 根据 A 的值来设置是否必须输入
在 A 的item 级触发器 post-change 应用:
if A = 'X' then
set_item_instance_property('block.B',current_record, required, property_true);
else
.......property_false);
end if;
结果是,当A 改变成 X 时,B, C 是变黄的,但是不输入值却可以保存;
而设想是变黄必须输入,如果不输入不能保存。
这是怎么回事?还是得在别的trigger 也写上?
2. post-change 有的人说这个trigger 已被抛弃不用了?
【风云】 发表于 2016-6-24 00:27
请问下,
1. 有一个form,是列表展现形式的;
假设有 column A , B , C
关于“2. post-change 有的人说这个trigger 已被抛弃不用了?”
可以看一下这两个trigger的说明
on-validate-field
An On-Validate-Field trigger fires during the Validate the Field event.
Trigger Specifically, it fires as the last part of field validation for fields with the
New or Changed validation status.
post-change
A Post-Change trigger fires when any of the following conditions occur:
the Validate the Field event determines that a field is marked
as Changed and is non-NULL
an operator reads a value into a field from a list of values
SQL*Forms reads a value into a field from a fetched record
两者还是有区别的,on-validate-field可用的场合更多,多数情况下可以取代post-change
所以,我的习惯一般是这样的:
1. base_table的block,query后,base_table字段影响非base_table字段的相关动作用post-query
2. 非base_table的block,fetch后,fetch的字段影响非fetch字段的相关动作用post-change
3. 用户修改字段影响相关字段的用on-validate-field