Repository.Model.DeleteModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{Template:APIClass|Repository Class|Repository}} {{Template:Repository.DeleteModel.Cmt}} == Syntax== DeleteModel({{APIPrefix|ByVal}} ID {{APIPrefix|As Integer}}) {{APIPrefix|As…')
 
No edit summary
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}}
{{Template:Repository.DeleteModel.Cmt}}


== Syntax==
DeleteModel({{APIPrefix|ByVal}} ID {{APIPrefix|As Integer}}) {{APIPrefix|As Boolean}}


Parameters
<onlyinclude>Deletes an unused model from the current project. Throws an exception if the model is in use. Returns a '''Boolean''' value; when true, indicates a successful deletion.</onlyinclude>
:''ID'': The ID to delete.


== Usage Example ==
== Syntax ==
  {{APIComment|'Declare a new repository connection object.}}
  '''.Model.DeleteModel'''(''ID'')
  Dim MyRepository As New Repository
 
 
=== Parameters ===
{{APIComment|'Connect to the Synthesis repository.}}
''ID''
  Dim Success As Boolean = False
:Required. Integer. The ID number of the model to delete.
  Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
 
 
 
{{APIComment|'Get the list of models in the connected repository.}}
== Example ==
  Dim ListOfModels() As [[NameIdPair Class|NameIdPair]]
This example assumes that an unused model with ID #71 exists in the first project of a Synthesis repository.
  ListOfModels = MyRepository.GetAllModelsInfo()
'''VBA|VB.NET'''
    
    
  {{APIComment|'Retrieve the model with ID &#061; 20.}}
  {{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}}
  Dim AModel as cModel
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  AModel = MyRepository.GetModel(20)
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
    
    
  {{APIComment|'Delete Model.}}
  {{APIComment|'Delete model #71 from project #1.}}
  MyRepository.DeleteModel(20)
  MyRepository.Project.SetCurrentProject(1)
     
  MyRepository.Model.DeleteModel(71)
{{APIComment|'Disconnect from the repository.}}
  MyRepository.DisconnectFromRepository

Latest revision as of 17:25, 8 April 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Deletes an unused model from the current project. Throws an exception if the model is in use. Returns a Boolean value; when true, indicates a successful deletion.

Syntax

.Model.DeleteModel(ID)

Parameters

ID

Required. Integer. The ID number of the model to delete.


Example

This example assumes that an unused model with ID #71 exists in the first project of a Synthesis repository.

VBA|VB.NET
 
 'Declare a new Repository object and connect to a Synthesis repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr10")
 
 'Delete model #71 from project #1. 
  MyRepository.Project.SetCurrentProject(1)
  MyRepository.Model.DeleteModel(71)