Repository.Variable.GetVariable: Difference between revisions
Jump to navigation
Jump to search
Kate Racaza (talk | contribs) No edit summary |
Kate Racaza (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<noinclude>{{Template:API}}{{Template:APIBreadcrumb|10|[[Repository Class|Repository]]}}</noinclude> | <noinclude>{{Template:API}}{{Template:APIBreadcrumb|10|.[[Repository Class|Repository]]}}</noinclude> | ||
Gets the variable with the designated ID number and returns it as a '''[[CVariable Class|cVariable]]''' object. Returns nothing if the variable does not exist or is not in the current project. | Gets the variable with the designated ID number and returns it as a '''[[CVariable Class|cVariable]]''' object. Returns nothing if the variable does not exist or is not in the current project. | ||
<noinclude> | <noinclude> | ||
== Syntax == | == Syntax == | ||
' | '''.Variable.GetVariable'''(''ID'') | ||
=== Parameters === | === Parameters === | ||
''ID'' | |||
:Integer. The ID number of the variable to retrieve. | |||
Line 20: | Line 16: | ||
'''VBA''' | '''VBA''' | ||
{{APIComment|'Add code to connect to a Synthesis repository.}} | |||
{{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | |||
{{APIComment|...}} | |||
{{APIComment|'Get variable #1 from project #1.}} | {{APIComment|'Get variable #1 from project #1.}} | ||
Line 28: | Line 26: | ||
{{APIPrefix|Set}} AVariable = MyRepository.Variable.GetVariable(1) | {{APIPrefix|Set}} AVariable = MyRepository.Variable.GetVariable(1) | ||
{{APIComment|'Output sample: Display the name and ID of variable | {{APIComment|'Output sample: Display the name and ID of the variable.}} | ||
{{APIPrefix|Dim}} VariableName {{APIPrefix|As}} String | {{APIPrefix|Dim}} VariableName {{APIPrefix|As}} String | ||
{{APIPrefix|Dim}} VariableID {{APIPrefix|As}} Integer | {{APIPrefix|Dim}} VariableID {{APIPrefix|As}} Integer | ||
Line 37: | Line 35: | ||
'''VB.NET''' | '''VB.NET''' | ||
{{APIComment|'Add code to connect to a Synthesis repository.}} | |||
{{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | |||
{{APIComment|...}} | |||
{{APIComment|'Get variable #1 from project #1.}} | {{APIComment|'Get variable #1 from project #1.}} | ||
Line 45: | Line 45: | ||
AVariable = MyRepository.Variable.GetVariable(1) | AVariable = MyRepository.Variable.GetVariable(1) | ||
{{APIComment|'Output sample: Display the name and ID of variable | {{APIComment|'Output sample: Display the name and ID of the variable.}} | ||
{{APIPrefix|Dim}} VariableName {{APIPrefix|As}} String | {{APIPrefix|Dim}} VariableName {{APIPrefix|As}} String | ||
{{APIPrefix|Dim}} VariableID {{APIPrefix|As}} Integer | {{APIPrefix|Dim}} VariableID {{APIPrefix|As}} Integer |
Revision as of 20:41, 20 July 2015
Member of: SynthesisAPI10.Repository
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
.Variable.GetVariable(ID)
Parameters
ID
- Integer. The ID number of the variable to retrieve.
Example
The example assumes that a variable with ID# 1 exists in the repository.
VBA 'Add code to connect to a Synthesis repository. Dim MyRepository As New 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 the variable. Dim VariableName As String Dim VariableID As Integer VariableName = AVariable.Name VariableID = AVariable.ID MsgBox ("You got " & VariableName & ", ID#" & VariableID)
VB.NET 'Add code to connect to a Synthesis repository. Dim MyRepository As New 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 the variable. Dim VariableName As String Dim VariableID As Integer VariableName = AVariable.Name VariableID = AVariable.ID MsgBox ("You got " & VariableName & ", ID#" & VariableID)