Repository.Model.GetModel: Difference between revisions
Jump to navigation
Jump to search
Kate Racaza (talk | contribs) mNo edit summary |
Kate Racaza (talk | contribs) No edit summary |
||
Line 2: | Line 2: | ||
<onlyinclude> | <onlyinclude>Returns a '''[[CModel Class|cModel]]''' object, which represents a model resource. Returns nothing if the model does not exist or is not in the current project.</onlyinclude> | ||
== Syntax == | == Syntax == | ||
Line 17: | Line 17: | ||
'''VBA''' | '''VBA''' | ||
{{APIComment|' | {{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}} | ||
{{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | ||
MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}}) | |||
{{APIComment|'Get model #47 from project#1.}} | {{APIComment|'Get model #47 from project#1.}} | ||
{{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel | |||
MyRepository.Project.SetCurrentProject(1) | |||
{{APIPrefix|Set}} AModel = MyRepository.Model.GetModel(47) | |||
{{APIComment|'Output sample: Display the name and ID of the model.}} | {{APIComment|'Output sample: Display the name and ID of the model.}} | ||
{{APIPrefix|Dim}} ModelName {{APIPrefix|As}} String | |||
{{APIPrefix|Dim}} ModelID {{APIPrefix|As}} Integer | |||
ModelName = AModel.Name | |||
ModelID = AModel.ID | |||
MsgBox ({{APIString|"You got "}} & ModelName & {{APIString|", ID#"}} & ModelID) | |||
'''VB.NET''' | '''VB.NET''' | ||
{{APIComment|' | {{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}} | ||
{{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | ||
MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}}) | |||
{{APIComment|'Get model #47 from project#1.}} | {{APIComment|'Get model #47 from project#1.}} | ||
{{APIPrefix|Dim}} AModel {{APIPrefix|As}} cModel | |||
MyRepository.Project.SetCurrentProject(1) | |||
AModel = MyRepository.Model.GetModel(47) | |||
{{APIComment|'Output sample: Display the name and ID of the model.}} | {{APIComment|'Output sample: Display the name and ID of the model.}} | ||
{{APIPrefix|Dim}} ModelName {{APIPrefix|As}} String | |||
{{APIPrefix|Dim}} ModelID {{APIPrefix|As}} Integer | |||
ModelName = AModel.Name | |||
ModelID = AModel.ID | |||
MsgBox ({{APIString|"You got "}} & ModelName & {{APIString|", ID#"}} & ModelID) |
Revision as of 16:49, 8 April 2016
Member of: SynthesisAPI.Repository
Returns a cModel object, which represents a model resource. Returns nothing if the model does not exist or is not in the current project.
Syntax
.Model.GetModel(ID)
Parameters
ID
- Required. Integer. The ID number of the model to retrieve.
Example
This example assumes that a model with ID #47 exists in the first project of a Synthesis repository.
VBA 'Declare a new Repository object and connect to a Synthesis repository. Dim MyRepository As New Repository MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr10") 'Get model #47 from project#1. Dim AModel As cModel MyRepository.Project.SetCurrentProject(1) Set AModel = MyRepository.Model.GetModel(47) 'Output sample: Display the name and ID of the model. Dim ModelName As String Dim ModelID As Integer ModelName = AModel.Name ModelID = AModel.ID MsgBox ("You got " & ModelName & ", ID#" & ModelID)
VB.NET 'Declare a new Repository object and connect to a Synthesis repository. Dim MyRepository As New Repository MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr10") 'Get model #47 from project#1. Dim AModel As cModel MyRepository.Project.SetCurrentProject(1) AModel = MyRepository.Model.GetModel(47) 'Output sample: Display the name and ID of the model. Dim ModelName As String Dim ModelID As Integer ModelName = AModel.Name ModelID = AModel.ID MsgBox ("You got " & ModelName & ", ID#" & ModelID)