Introduced in QPR 2012.2
Last changed in QPR 2016.1
Imports element types, custom attribute types, and custom hierarchies from a source model to the currently open model. In addition, copies the model license information from the source model to the target model.
PGModel.ImportTypes(Model, Parameters, out Log)
Model: Variant. Server model ID (integer), server model name (string), or a file name (string). File name can have an absolute or a relative path. If no path is given, function tries to load the import model from the current Modeling Client default path. Also server models require the path information to be visible in the case the model is identified by a name string, so for example \\ModelName or \\folder\ModelName are valid values.
Parameters: A semicolon-separated list. Supported parameters:
|•||ElementTypes: Boolean. If true, imports element types, identified by symbol and meta type. Default value false.|
|•||AttributeTypes: Boolean. If true, imports custom attribute types, identified by name and data type. Default value false. Note that all custom attribute types must be uniquely identifiable in both the source model and the target model. Otherwise attribute types will not be correctly updated, i.e. only the first matching type is updated. "Uniquely identifiable" means that the custom attribute type names must be unique inside a data type, for example all Text attribute types names must be unique, but for example Text and Memo types can have same names. Name matching is case insensitive. If models use multilingual modeling, name matching is done using the models' default language translations.|
|•||Hierarchies: Boolean. If true, imports custom hierarchy definitions, identified by symbol. Default value is false.|
|•||Add: Boolean. If true, the missing types or hierarchies are added to the meta model. Default value is false.|
|•||Update: Boolean. If true, existing types or hierarchies in the target model are updated. Default value is false. Type properties are updated (name, description, behavior options when possible, stencil, etc.). Custom attribute types linked to element types are synchronized. Hierarchy definitions are synchronized (basic properties and element types belonging to hierarchies). Note that when hierarchies are updated, if an element type that does not exist in the source model belongs to the hierarchy in the target model, the element type will not be removed from the hierarchy.|
|•||Delete: Boolean. If true, types or hierarchies that do not exist in the source meta-model are deleted from the target meta-model. Default value is false. All elements of the deleted type are also deleted from the target model. The only exception is that if current model is a base model and the deleted type is a diagram type, the elements (in this model and all child models) are changed to be the default diagram type or the first found type with Diagram behavior if this is an element type. The last diagram process step type, or the last element type with Diagram behavior cannot be removed from a base model that has child models.|
|•||GenerateChangeList: Boolean. If true, the out Log array is generated on all imported element types. The description is empty for those element types that have no conflict. Default value is false.|
out Log: Variant array. Log is a two-dimensional variant array containing one entry for each conflict encountered in import. Each entry contains the following information:
|o||Element type/Custom attribute type/Hierarchy ID in the currently open model. Integer.|
|o||Element type/Custom attribute type/Hierarchy ID in the imported model. Integer.|
|o||Element type/Custom Attribute type/Hierarchy name. String.|
|o||Element type/Hierarchy symbol. String.|
|o||Conflict description. String.|
Note that using the "Add", "Update", and "Delete" options at the same time with "ElementTypes", "AttributeTypes", and "Hierarchies" options, will synchronize the meta-models.
In addition, if the model is a base model that has child models, and diagram element types are deleted from the model, the model will be saved automatically.
System or model administrator.
Below are listed the return values that this function can return:
Dim i, iResult, aoLog, sLog
iResult = PGModel.ImportTypes("G:\temp\models\source.qprdam", "ElementTypes=True;AttributeTypes=True;Hierarchies=True;Add=True;Update=True;Delete=True", aoLog)
If iResult <> 0 Then
MsgBox "ImportTypes failed: " + PGApplication.GetErrorMessage(iResult)
ElseIf Not (IsEmpty(aoLog) or IsNull(aoLog)) Then
sLog = ""
For i = 0 To ubound(aoLog)
sLog = sLog + "Element: """ + aoLog(i,2) + """, Symbol: """ + aoLog(i,3) + """ - " + aoLog(i,4) + vbCrLf
MsgBox "Conflicts:" + vbCrLf + sLog
MsgBox "ImportTypes successful"