Repository.Model.GetModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
{{Template:API}}
{{Template:API}}
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.  
To get a local model, you must first specify a current/active project (see the [[Repository.Project.SetCurrentProject|Project.SetCurrentProject method]]). There is no need to specify a current project for global models.


== Syntax ==
== Syntax ==
Line 16: Line 18:


== Example ==
== Example ==
These examples assume that a model with the ID#47 exists in the project.
These examples assume that a model with the ID# 47 exists in the repository.


  '''VBA'''<br>
  '''VBA'''<br>
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIComment|...'Add code to connect to a Synthesis repository.}}   
  {{APIComment|...'Add code to connect to a Synthesis repository.}}   
  {{APIComment|...'Add code to set one of the projects in the repository as the current (active) project.}}<br>
  {{APIComment|...'If getting a local model, add code to specify the current project.}}<br>
   {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
   {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
   {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(47)
   {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(47)
Line 28: Line 30:
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIComment|...'Add code to connect to a Synthesis repository.}}   
  {{APIComment|...'Add code to connect to a Synthesis repository.}}   
  {{APIComment|...'Add code to set one of the projects in the repository as the current (active) project.}}<br>
  {{APIComment|...'If getting a local model, add code to specify the current project.}}<br>
   {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
   {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
   AModel = MyRepository.Model.GetModel(47)
   AModel = MyRepository.Model.GetModel(47)

Revision as of 22:46, 13 July 2015

Member of: SynthesisAPI10Repository

APIWiki.png


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.

To get a local model, you must first specify a current/active project (see the Project.SetCurrentProject method). There is no need to specify a current project for global models.

Syntax

object.Model.GetModel(Integer)

where object is a variable that represents a Repository object.

Parameters

Name Description
IDborder="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse; text-align: left; cellborder"
Name Status Integer. The ID number of the model to retrieve.


Example

These examples assume that a model with the ID# 47 exists in the repository.

VBA
Dim MyRepository As New Repository ...'Add code to connect to a Synthesis repository. ...'If getting a local model, add code to specify the current project.
Dim AModel As cModel Set AModel = MyRepository.Model.GetModel(47)
VB.NET
Dim MyRepository As New Repository ...'Add code to connect to a Synthesis repository. ...'If getting a local model, add code to specify the current project.
Dim AModel As cModel AModel = MyRepository.Model.GetModel(47)