1. 程式人生 > >CDM中遍歷域及其約束條件、取值範圍、引用它的項目

CDM中遍歷域及其約束條件、取值範圍、引用它的項目

最大值 next folder values active valid cit proc not

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

CDM中遍歷域及其約束條件、取值範圍、引用它的項目