cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Power Designer: Cannot sort partition columns using scripting

0 Likes
691

Hi everyone!

We are trying to order the partitions of a table via scripting but we haven't succeeded yet. We found the problem when creating the record in the "Partitions" tab.

If we do it manually, the result is this:

However we don't know how to replicate that via scripting. Is it possible? Can anyone help us? At this moment this is our code:

Option Explicit

Dim mdl : set mdl = ActiveModel

Dim tbl, t , c ,objNewEC, objContent

dim havePartitions : havePartitions = false

set tbl = mdl.FindChildByCode("t_XXXXXXXXX",Cls_Table)

If tbl is nothing then

output "no se encontro la tabla"

Else

output "tbl.ExtendedCompositions.count=[" & tbl.ExtendedCompositions.count & "]"

If tbl.ExtendedCompositions.count > 0 then

set c = tbl.ExtendedCompositions.item(0)

output c.name

If strComp(c.name,"Partitions") = 0 then

havePartitions = true

End If

Else ' no hay ExtendedCompositions

havePartitions = false

output "Se crea la ExtendedCompositions para Partitions"

'set objNewEC = tbl.CreateObject(PdCommon.cls_ExtendedComposition)

set objNewEC = tbl.ExtendedCompositions.CreateNew

If not objNewEC is nothing then

objNewEC.name ="Partitions"

set objContent = objNewEC.Content.CreateNew

objContent.Name = "Partition_1"

objContent.Code = "Partition_1"

objContent.stereotype = "Partition"

Else

output "No se puede crear ExtendedCompositions"

End If

End If

End If ' si no encontro la tabla

With our code we only manage to create de partitions in the green part of the image but not the record in the partitions tab (red part of the image).

Thank you very much!!

View Entire Topic
0 Likes

Thank you very much ondrej_divis, that solved our problem!