Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ‘当前model
‘获取当前活动model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model "
ElseIf Not mdl.IsKindOf(PdcDM.cls_Model) Then ‘如果是处理pdm,这里换成PdPDM.cls_Model
MsgBox "The current model is not an Physical Data model. "
Else
ProcessFolder mdl
End If
‘ This routine copy name into comment for each table, each column and each view ‘ of the current folder
Private sub ProcessFolder(folder)
‘域只在根目录Model下存在,所以不用递归查找下级目录的域,而且要找的话下级目录会报错
output folder.ObjectType+" "+folder.name
Dim dm ‘要处理的域
for each dm in folder.domains ‘只有根目录为Model的域才有.domains属性
if not dm.isshortcut then ‘先处理表名
output dm.code ‘域code
output dm.LowValue ‘域的最小值约束
output dm.HighValue ‘域的最大值约束
output dm.ServerCheckExpression ‘域的正则表达式约束
output dm.ListOfValues ‘域的取值范围
dim ref
for each ref in dm.dataitems ‘引用此domain的每个字段
output ref.code+" /"+ref.UsedBy ‘列举字段名称和所在表名
next
end if
next
end sub