Repository.Model.GetModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{Template:APIBreadcrumb|10|Repository}}
{{Template:Repository.GetModel.Cmt}}
{{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.  


''Note regarding compound analytical models:'' After you connect to a database and create the cModel using [[Repository Class]] ([[Repository.GetModel|GetModel]] or [[Repository.GetAllModels|GetAllModels]] methods), the [[Repository Class]] must stay connected to the same database until you are done working with the model.
== Syntax ==
''object''.'''Model.GetModel(''Integer'')'''


== Syntax==
where ''object'' is a variable that represents a Repository object.
*GetModel( ID{{APIPrefix|As Integer}}){{APIPrefix|As}}[[cModel Class|cModel]]


Parameters
=== Parameters ===
:''ID'': The ID of the model to retrieve.
{| {{APITable}}
|-
|ID{{APIParam|Required}}||'''Integer'''. The ID number of the model to retrieve.
|}


==Usage Example==
 
{{Template:RepositoryFull.Ex}}
== Example ==
These examples assume that a model with the ID#47 exists in the project.
 
'''VBA'''<br>
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} 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>
  {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
  {{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(47)
 
'''VB.NET'''<br>
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} 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>
  {{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel
  AModel = MyRepository.Model.GetModel(47)

Revision as of 22:33, 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.

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 project.

VBA
Dim MyRepository As New Repository ...'Add code to connect to a Synthesis repository. ...'Add code to set one of the projects in the repository as the current (active) 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. ...'Add code to set one of the projects in the repository as the current (active) project.
Dim AModel As cModel AModel = MyRepository.Model.GetModel(47)