Repository.Project.GetAllProjects: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
(Undo revision 54551 by Chris Kahn (Talk))
Line 5: Line 5:
*GetAllProjects(){{APIPrefix|As}}[[NameIdPair Class|NameIdPair]]()
*GetAllProjects(){{APIPrefix|As}}[[NameIdPair Class|NameIdPair]]()


== Usage Example ==
In this usage example, the API is used to connect to a repository, retrieve one of the models in it and then calculate the reliability at a specified time, based on that model.
{{APIComment|'Declare a new repository connection class. See [[Repository Class|Repository]].}}
{{Template:Repository.Ex}}
{{Template:Repository.Ex}}

Revision as of 20:21, 27 May 2014


Returns an array containing all project names and their IDs from the current repository.

Syntax

Usage Example

In this usage example, the API is used to connect to a repository, retrieve one of the models in it and then calculate the reliability at a specified time, based on that model.

 'Declare a new repository connection class. See Repository. 
 Dim MyRepository As New Repository
 
 'Connect to a Synthesis repository. 
 Dim Success As Boolean = False
 Success = MyRepository.ConnectToRepository("C:\Users\Name\Documents\ReliaSoft\Files\repository.rsr10")
 
 'Get a list of the names/IDs of projects in the connected repository. 
 Dim ListOfProjects() As NameIdPair
 ListOfProjects = MyRepository.Project.GetAllProjects()
 
 'Open the first project in the list. 
 MyRepository.Project.SetCurrentProject(ListOfProjects(0).ID)
 
 'Get a list of the names/IDs of models in the current project. 
 Dim ListOfModels() As NameIdPair
 ListOfModels = MyRepository.Model.GetAllModelsInfo()
 
 'Retrieve the first model in the list. 
 Dim AModel As cModel
 AModel = MyRepository.Model.GetModel(ListOfModels(0).ID)
 
 'Calculate the reliability at time = 50 and save the result. See Reliability. 
 Dim Rel As Double
 Rel = AModel.Reliability(50)
 
 'Disconnect from the repository. 
 MyRepository.DisconnectFromRepository()