Repository.Model.GetAllModels: 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.GetAllModels.Cmt}}
{{Template:API}}
Gets a list of all existing local models in the current project (does not include global models). Returns a '''[[CModel Class|cModel]]''' object array that contains the model names, ID numbers and other information.  


''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.GetAllModels()'''


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


== Usage Example ==
== Example ==
<div style="margin-right: 150px;">
'''VBA|VB.NET'''<br>
{{APIComment|'Declare a new repository connection object.}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  Dim MyRepository As New Repository
  {{APIComment|...'Add code to connect to a Synthesis repository.}}
 
  {{APIComment|...'Then set one of the projects in the repository as the current (active) project.}}<br>
  {{APIComment|'Connect to the Synthesis repository.}}
   {{APIPrefix|Dim}} ListofModels() {{APIPrefix|As}} cModel
  Dim Success As Boolean = False
   ListofModels = MyRepository.Model.GetAllModels()
  Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
 
  {{APIComment|'Set a first available project as current.}}
  MyRepository.Project.SetCurrentProject(0)
{{APIComment|'Get an array of [[cModel Class|cModel]] representing all the models in the Current Project.}}
   Dim ListOfModels() As [[cModel Class|cModel]]
   ListOfModels = MyRepository.Model.GetAllModels()
</div>

Revision as of 22:07, 13 July 2015

Member of: SynthesisAPI10Repository

APIWiki.png


Gets a list of all existing local models in the current project (does not include global models). Returns a cModel object array that contains the model names, ID numbers and other information.

Syntax

object.Model.GetAllModels()

where object is a variable that represents a Repository object.

Example

VBA|VB.NET
Dim MyRepository As New Repository ...'Add code to connect to a Synthesis repository. ...'Then set one of the projects in the repository as the current (active) project.
Dim ListofModels() As cModel ListofModels = MyRepository.Model.GetAllModels()