在Powerdesigner中,根据已有字段的Name值替换Code相同的Name的值

如果在powerdesigner中有一个表我已经把名子和你码对应好了.
比如Name是年,Code是year,那么怎么把别的表中的Code是Year的Name设成年呢?
用以下代码即可,哈哈.调好了.

Dim nb
nb=ActiveSelection.Count
if nb=0 then
Output "No selected Objects"
end if
dim obj
Dim d                   '创建一个变量  and (not d.Exists(col.Code))
Set d = CreateObject("Scripting.Dictionary")
for Each obj in ActiveSelection
  for each col in obj.Columns
    if (col.Code<>col.Name) and (not d.Exists(col.Code))then
    Output "--"+obj.Name+"."+obj.Code+"="+col.Name+"."+col.Code
      d.Add col.Code,col.Name
     end if
  next
next
for Each obj in ActiveSelection
  for each col in obj.Columns 
    if (col.Code=col.Name) and (d.Exists(col.Code) )then
     Output col.Name+"."+col.Code+"."+d.Item(col.Code)
      col.Name=d.Item(col.Code)
     end if
  next
next
千人.NET交流群:18362376,因为有你,代码变得更简单,加群请输入cnblogs
原文地址:https://www.cnblogs.com/kingkoo/p/1283986.html