Repository.Model.DeleteModel: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{Template:APIBreadcrumb|10|Repository}}
{{Template:Repository.DeleteModel.Cmt}}
{{Template:API}}
Deletes an unused model from the Synthesis repository. Throws an exception if the model is in use. Returns a '''Boolean''' value; when true, indicates that the model does not exist.  


== Syntax==
== Syntax ==
DeleteModel({{APIPrefix|ByVal}} ID {{APIPrefix|As Integer}}) {{APIPrefix|As Boolean}}
''object''.'''Model.DeleteModel(''ID'')'''


Parameters
where ''object'' is a variable that represents a Repository object.
:''ID'': The ID to delete.


== Usage Example ==
=== Parameters ===
{{APIComment|'Declare a new repository connection object.}}
{| {{APITable}}
  Dim MyRepository As New Repository
|-
 
|ID{{APIParam|Required}}||The ID number of the model to delete.
{{APIComment|'Connect to the Synthesis repository.}}
|}
  Dim Success As Boolean = False
 
  Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
 
    
== Example ==
  {{APIComment|'Set a first available project as current.}}
This example assumes that an unused model with ID#71 exists in a repository.
  MyRepository.Project.SetCurrentProject(0)
'''VBA|VB.NET'''
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIComment|...'Add code to connect to a Synthesis repository.}}
   
   
  {{APIComment|'Get the list of models in the connected repository.}}
  {{APIComment|'Delete model #71 from project #1. The model will no longer be visible in the Synthesis repository upon refresh.}}
   Dim ListOfModels() As [[NameIdPair Class|NameIdPair]]
   MyRepository.Project.SetCurrentProject (1)
  ListOfModels = MyRepository.Model.GetAllModelsInfo()
   MyRepository.Model.DeleteModel(71)
 
{{APIComment|'Retrieve the model with ID = 20.}}
  Dim AModel as cModel
  AModel = MyRepository.Model.GetModel(20)
    
{{APIComment|'Delete Model.}}
  Dim SucessDeleteModel As Boolean
  SucessDeleteModel = MyRepository.Model.DeleteModel(20)
     
{{APIComment|'Disconnect from the repository.}}
  MyRepository.DisconnectFromRepository

Revision as of 20:39, 14 July 2015

Member of: SynthesisAPI10Repository

APIWiki.png


Deletes an unused model from the Synthesis repository. Throws an exception if the model is in use. Returns a Boolean value; when true, indicates that the model does not exist.

Syntax

object.Model.DeleteModel(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 The ID number of the model to delete.


Example

This example assumes that an unused model with ID#71 exists in a repository.

VBA|VB.NET

 Dim MyRepository As New Repository
 ...'Add code to connect to a Synthesis repository.   

 'Delete model #71 from project #1. The model will no longer be visible in the Synthesis repository upon refresh. 
 MyRepository.Project.SetCurrentProject (1)
 MyRepository.Model.DeleteModel(71)