【问题标题】:powerdesigner vb/vba how to set default table mapping for excel source 2 target extractpowerdesigner vb/vba 如何为 excel 源 2 目标提取设置默认表映射
【发布时间】:2017-07-12 14:58:05
【问题描述】:

我正在编写一个脚本,以从 powerdesigner 16 中提取源数据到目标数据。我有一个表源自 powerdesigner MAPPING_1、MAPPING_2、ETC 中的多个映射。我不知道如何使用 vba 代码设置默认映射。我目前正在使用下面的代码访问映射。它将访问我上次保存数据模型时处于活动状态的默认映射。如果有人对如何做到这一点有见解,我将非常感激。

谢谢

'
' get the table
'   Dim mytable, col, cm
    mytable = 'CUSTOMER_STAGING'
    Dim obj As PdCommon.IdentifiedObject
    Set obj = baseModel.FindChildByCode(mytable, cls_Table)

    For Each col In obj.Columns
       For Each cm In col.Mappings
       Next
    next

【问题讨论】:

    标签: vba excel powerdesigner


    【解决方案1】:

    不完全相同的对象,因为我开始使用概念模型。两个源和一个目标,都具有名为 Entity_1、Entity_2 的实体,映射设置为向导除外。

    不完全一样的代码,因为我开始玩 VBScript...

    但似乎我可以通过设置 DefaultMapping 属性来更改默认映射:

    option explicit
    dim myname
    myname = "ENTITY_1"
    Dim obj : Set obj = ActiveModel.FindChildByCode(myname, cls_Entity)
    output "default: " & obj.defaultmapping
    dim cm,changed
    changed = false
    For Each cm In obj.Mappings
       output cm
       if cm <> obj.defaultmapping and not changed then
          output "set to " & cm
          changed = true
          set obj.defaultmapping=cm
       end if
    Next
    output "default: " & obj.defaultmapping
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-27
      • 1970-01-01
      • 2018-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-18
      相关资源
      最近更新 更多