Repository.Variable.GetVariable

From ReliaWiki
Revision as of 22:34, 16 July 2015 by Kate Racaza (talk | contribs)
Jump to navigation Jump to search
APIWiki.png


Member of: SynthesisAPI10Repository

Gets the variable with the designated ID number and returns it as a cVariable object. Returns nothing if the variable does not exist or is not in the current project.

Syntax

object.Variable.GetVariable(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 variable to retrieve.


Example

The example assumes that a variable with ID# 1 exists in the repository.

VBA

 Dim MyRepository As New Repository
 ...'Add code to connect to a Synthesis repository. 
  
 'Get variable #1 from project #1. 
 Dim AVariable As cVariable
 MyRepository.Project.SetCurrentProject(1)
 Set AVariable = MyRepository.Variable.GetVariable(1)

 'Output sample: Display the name and ID of variable #1. 
 Dim VariableName As String
 Dim VariableID As Integer
 VariableName = AVariable.Name
 VariableID = AVariable.ID
 MsgBox ("You got " & VariableName & ", ID#" & VariableID)
VB.NET

 Dim MyRepository As New Repository
 ...'Add code to connect to a Synthesis repository. 
  
 'Get variable #1 from project #1. 
 Dim AVariable As cVariable
 MyRepository.Project.SetCurrentProject(1)
 AVariable = MyRepository.Variable.GetVariable(1)

 'Output sample: Display the name and ID of variable #1. 
 Dim VariableName As String
 Dim VariableID As Integer
 VariableName = AVariable.Name
 VariableID = AVariable.ID
 MsgBox ("You got " & VariableName & ", ID#" & VariableID)