发信人: kamkam(KK)
整理人: kamkam(2002-05-04 21:58:47), 站内信件
|
使用‘显示时计算’域来避免不必要的重复计算。下表是使用各种类型域时,不同事件引发的计算情况:
Field Create Open Open Show Save Refresh
Type (empty) (data) Dialog
Edit DV IT,IV IT IV
(normal)
Edit DV KF KF IT,IV IT IV
(K-UF-DB)
Edit KF,DV KF KF IT,IV IT IV
(K-UF-Not DB)
Computed V V V
Computed for
display V V V V V
Computed for
composed V
上面缩写的解释
normal----Normal edit field (not one of the two special ones that follow)
K-UF-DB---Keyword, Use formula for choices, dialog box
K-UF-Not DB---Keyword, Use formula for choices, check boxes or radio buttons
DV -----Default value formula executes
IT -----Input translation formula executes
IV -----Input validation formula executes
KF -----Keyword formula executes
V -----Value formula executes
Create----Field is being created (either because the document is being created
or an existing document is opened that does not contain the field)
Open -----Opening an existing document — in either Read or Edit mode
Empty---Field is empty (exists in document but has no contents)
data-----Field has data
Show Dialog---User presses the icon to display the dialog box
注意两点
1.使用check box和radio box,一打开文档,公式总要计算,即使仅仅打算阅读而不是修改文档,看起来是合理的,因为需要计算出各个项目供阅读嘛
2.已经有数据的,使用对话框格式的编辑域,打开时候也要重新计算,这个就不太合理了
当使用复杂的@dblookup时,性能有很大影响。隐藏公式域没有作用,因为仍然会发生计算。按照下面方法解决
1.创建一个隐藏的多值‘显示时计算’域:kwDataHidden,计算公式是原来的@dblookup公式,但仍然要做如下处理
值公式写成这样:
rem "Do not run formula during doc save";
@if (@IsDocBeingSaved; @Return("");"");
rem "Only run if doc is in edit mode";
@if (@IsDocBeingEdited;@DBColumn(............);"")
2.在表单的PostModeChange中,写:@If(@IsDocBeingEdited;@Command([ViewRefreshFields]);""),(实际上,如果觉得公式的值的修改频率不是太快的话,这里也可以不写)
3.真正操作那个域的公式写:kwDataHidden;并且该域属性选择‘刷新文档时刷新选项’
---- ---------------
我心是澎湃的海 我心是动荡的舟 |
|