如何在Powerdesigner中使用VBScript?

发布于 2024-07-18 08:39:05 字数 613 浏览 9 评论 0原文

在Powerdesign中想要创建一个VBscript来重命名/修改powerdesigner中的以下名称 - 概念或物理模型

替代/唯一键名称:

<块引用>

UQ {table_name} {tablecolumnname} /////// 示例 = UQ_Account_AccountNumber

关系名称:

<块引用>

FK_{table_name}_{reference_table_name}_{reference_column_name} //////示例 = FK_Account_AccountPhone_HomePhoneID

问题是,如何获取“table_column_name”和“reference_column_name”?

In Powerdesign would like to create a VBscript to rename/reform the following names in powerdesigner- Conceptural or Physical model

Alternative/Unique Key Name:

UQ {table_name} {tablecolumnname} ///////
Example = UQ_Account_AccountNumber

Relationship Name:

FK_{table_name}_{reference_table_name}_{reference_column_name}
//////Example = FK_Account_AccountPhone_HomePhoneID

Problem is, how do I get the "table_column_name" and "reference_column_name"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2024-07-25 08:39:05

这是我用来重命名“友好”名称的东西,加上我所有引用的约束名称。 也许它会对你有所帮助。

Option Explicit
ValidationMode  = True
InteractiveMode = im_Batch

Dim mdl 
Set mdl = ActiveModel
If (mdl Is Nothing) Then
   MsgBox "There is no current Model"
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
   MsgBox "The current model is not a Physical Data model."
Else
   ProcessFolder mdl
End If

Private sub ProcessFolder(folder)
   Dim Tab, Key, Rel
   for each Rel in Folder.References
      Rel.ForeignKeyConstraintName = "FK_" + UCASE(Rel.ParentTable.Name) + "_" + UCASE(Rel.ParentKeyColumnList) + "_" + UCASE(Rel.ChildTable.Name) + "_" + UCASE(Rel.ForeignKeyColumnList)
      Rel.Name = "FK_" + UCASE(Rel.ParentTable.Name) + "_" + UCASE(Rel.ParentKeyColumnList) + "_" + UCASE(Rel.ChildTable.Name) + "_" + UCASE(Rel.ForeignKeyColumnList)
   next
end sub

Here's something I used to rename the 'friendly' names, plus the constraint names of all my references. Maybe it will help you out.

Option Explicit
ValidationMode  = True
InteractiveMode = im_Batch

Dim mdl 
Set mdl = ActiveModel
If (mdl Is Nothing) Then
   MsgBox "There is no current Model"
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
   MsgBox "The current model is not a Physical Data model."
Else
   ProcessFolder mdl
End If

Private sub ProcessFolder(folder)
   Dim Tab, Key, Rel
   for each Rel in Folder.References
      Rel.ForeignKeyConstraintName = "FK_" + UCASE(Rel.ParentTable.Name) + "_" + UCASE(Rel.ParentKeyColumnList) + "_" + UCASE(Rel.ChildTable.Name) + "_" + UCASE(Rel.ForeignKeyColumnList)
      Rel.Name = "FK_" + UCASE(Rel.ParentTable.Name) + "_" + UCASE(Rel.ParentKeyColumnList) + "_" + UCASE(Rel.ChildTable.Name) + "_" + UCASE(Rel.ForeignKeyColumnList)
   next
end sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文