Repository.Model.GetModel: Difference between revisions
Jump to navigation
Jump to search
Kate Racaza (talk | contribs) No edit summary |
Kate Racaza (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<noinclude>{{Template:API}}{{Template:APIBreadcrumb|10|[[Repository Class|Repository]]}}</noinclude> | <noinclude>{{Template:API}}{{Template:APIBreadcrumb|10|.[[Repository Class|Repository]]}}</noinclude> | ||
Gets the model with the designated ID number and returns it as a '''[[CModel Class|cModel]]''' object. Returns nothing if the model does not exist or is not in the current project. | Gets the model with the designated ID number and returns it as a '''[[CModel Class|cModel]]''' object. Returns nothing if the model does not exist or is not in the current project. | ||
<noinclude> | <noinclude> | ||
== Syntax == | == Syntax == | ||
' | '''.Model.GetModel'''(''ID'') | ||
=== Parameters === | === Parameters === | ||
''ID'' | |||
:Integer. The ID number of the model to retrieve. | |||
== Example == | == Example == | ||
This example assumes that a model with ID# 47 exists in the repository. | |||
'''VBA''' | '''VBA''' | ||
{{APIComment|'Add code to connect to a Synthesis repository.}} | |||
{{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | |||
{{APIComment|...}} | |||
{{APIComment|'Get model #47 from project#1.}} | {{APIComment|'Get model #47 from project#1.}} | ||
Line 37: | Line 36: | ||
'''VB.NET''' | '''VB.NET''' | ||
{{APIComment|'Add code to connect to a Synthesis repository.}} | |||
{{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | |||
{{APIComment|...}} | |||
{{APIComment|'Get model #47 from project#1.}} | {{APIComment|'Get model #47 from project#1.}} |
Revision as of 20:38, 20 July 2015
Member of: SynthesisAPI10.Repository
Gets the model with the designated ID number and returns it as a cModel object. Returns nothing if the model does not exist or is not in the current project.
Syntax
.Model.GetModel(ID)
Parameters
ID
- Integer. The ID number of the model to retrieve.
Example
This example assumes that a model with ID# 47 exists in the repository.
VBA 'Add code to connect to a Synthesis repository. Dim MyRepository As New Repository ... 'Get model #47 from project#1. Dim AModel As cModel MyRepository.Project.SetCurrentProject(1) Set AModel = MyRepository.Model.GetModel(47) 'Output sample: Display the name and ID of the model. Dim ModelName As String Dim ModelID As Integer ModelName = AModel.Name ModelID = AModel.ID MsgBox ("You got " & ModelName & ", ID#" & ModelID)
VB.NET 'Add code to connect to a Synthesis repository. Dim MyRepository As New Repository ... 'Get model #47 from project#1. Dim AModel As cModel MyRepository.Project.SetCurrentProject(1) AModel = MyRepository.Model.GetModel(47) 'Output sample: Display the name and ID of the model. Dim ModelName As String Dim ModelID As Integer ModelName = AModel.Name ModelID = AModel.ID MsgBox ("You got " & ModelName & ", ID#" & ModelID)