Repository.Model.GetModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Template:APIBreadcrumb|10|Repository}}
<noinclude>{{Template:API}}{{Template:APIBreadcrumb|10|Repository}}</noinclude>
{{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.  
 
<noinclude>
== Syntax ==
== Syntax ==
''object''.'''Model.GetModel(''ID'')'''
''object''.'''Model.GetModel(''ID'')'''
Line 51: Line 51:
   ModelID = AModel.ID
   ModelID = AModel.ID
   MsgBox ({{APIString|"You got "}} & ModelName & {{APIString|", ID#"}} & ModelID)
   MsgBox ({{APIString|"You got "}} & ModelName & {{APIString|", ID#"}} & ModelID)
</noinclude>

Revision as of 22:34, 16 July 2015

APIWiki.png


Member of: SynthesisAPI10Repository

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

object.Model.GetModel(ID)

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 ID# 47 exists in the repository.

VBA

 Dim MyRepository As New Repository
 ...'Add code to connect to a Synthesis repository. 
  
 'Get model #47 from project#1. 
 Dim AModel As cModel
 MyRepository.Project.SetCurrentProject(1)
 Set AModel = MyRepository.Model.GetModel(47)

 'Output sample: 
 Dim ModelName As String
 Dim ModelID As Integer
 ModelName = AModel.Name
 ModelID = AModel.ID
 MsgBox ("You got " & ModelName & ", ID#" & ModelID)
VB.NET

 Dim MyRepository As New Repository
 ...'Add code to connect to a Synthesis repository.   

 'Get model #47 from project#1. 
 Dim AModel As cModel
 MyRepository.Project.SetCurrentProject(1)
 AModel = MyRepository.Model.GetModel(47)

 'Output sample: 
 Dim ModelName As String
 Dim ModelID As Integer
 ModelName = AModel.Name
 ModelID = AModel.ID
 MsgBox ("You got " & ModelName & ", ID#" & ModelID)