Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9090

Re: Cannot access Diagram metadata via GTL or VB Script

$
0
0

Hi,

You may use the EvaluateTextFor on Object, and use the .Q macro to quote the desired properties.

Ex.

<<

Function %Get%(obj)

   dim sym, sobj, str
   for each sym in obj.Symbols
      if (sym.isKindOf(cls_ObjectSymbol)) then
         if(str <> "") then str = str & vbCrLf
         str = str & sym.Object.EvaluateTextFor("%.Q:ClassName%\t%.Q:Code%\t%.Q:Name%\t%.Q:Comment%", "%CurrentTargetCode%")
      end if
   next
   %Get% = str

End Function

>>


Nice [productive] solution will be to add a template in "NamedObject" with a default description, ie <<%.Q:Code%\t%.Q:Name%\t%.Q:Comment%>>
that you may override in specific object type. For instance, Entity would display specifc properties, and attributes others.
You will have a template (say "xlsDump") under NamedObject with a default contents.
But in Entity, the same template will have additional parent entity for instance, so the same template "xlsDump" will contain <<%.Q:Code%\t%.Q:Name%\t%.Q:Comment%\t[%ParentEntity%?%.Q:ParentEntity.Name%:"No parent"]>>

Ex.
NamedObject.xlsDump=
%.Q:ClassName%\t%.Q:Code%\t%.Q:Name%\t%.Q:Comment%

Entity.xlsDump=
%.Q:ClassName%\t%.Q:Code%\t%.Q:Name%\t%.Q:Comment%\t[%ParentEntity%?%.Q:ParentEntity.Name%:"No parent"]\n
.foreach_item("Attributes")
%xlsDump%
.next("\n")

EntityAttribute.xlsDump=
%.Q:ClassName%\t%.Q:Code%\t%.Q:Name%\t%.Q:Comment%\t%.Q:DataType%

You LogicalDiagram.XPreview extended attribute Get Method Script =
Function %Get%(obj)

   dim sym, sobj, str
   for each sym in obj.Symbols
      if (sym.isKindOf(cls_ObjectSymbol)) then
         if(str <> "") then str = str & vbCrLf
         str = str & sym.Object.EvaluateTextFor("%xlsDump%", "%CurrentTargetCode%")
      end if
   next
   %Get% = str

End Function

You will have a preview page as
<<
"Entity" "CAR" "Car" "Car vehicle" "Vehicle"
"Entity Attribute" "NUMBEROFSEATS" "NumberOfSeats" "" "I"
"Entity Attribute" "TYPE" "Type" "" "VA128"
"Entity Attribute" "CONDUCTORSEATSLEFT" "ConductorSeatsLeft" "" "BL"
"Entity" "VEHICLE" "Vehicle" "" "No parent"
"Entity Attribute" "NUMBEROFSEATS" "NumberOfSeats" "" "I"
"Entity Attribute" "TYPE" "Type" "" "VA128"
"Inheritance" "INHERITANCE_1" "Inheritance_1" ""
>>

 

for a simple model Vehicule(NumberOfSeats,Type) <-[inhr]--Car(ConductorSeatsLeft)

 

Marc


Viewing all articles
Browse latest Browse all 9090

Trending Articles