Repository.Model.IsModelUsed: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>{{Template:API}}{{Template:APIBreadcrumb|10|[[Repository Class|Repository]]}}</noinclude>
{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}}
 
 
<onlyinclude>Checks whether the model is used by other items in the project. Returns a '''Boolean''' value; when true, indicates that the model is in use.</onlyinclude>  


Checks whether the model with the ID number that you specify is used by other items in the project. Returns a '''Boolean''' value; when true, indicates that the model is in use.
<noinclude>
== Syntax ==
== Syntax ==
''object''.'''Model.IsModelUsed(''ID'')'''
'''.Model.IsModelUsed'''(''ID'')
 
where ''object'' is a variable that represents a Repository object.


=== Parameters ===
=== Parameters ===
{| {{APITable}}
''ID''
|-
:Required. Integer. The ID number of the model to be checked.  
|ID{{APIParam|Required}}||'''Integer'''. The ID number of the model to be checked.  
|}




== Example ==
== Example ==
This example assumes that a model with ID# 42 exists in the repository.
This example assumes that a model with ID #42 exists in the first available project of a Synthesis repository.
  '''VBA|VB.NET'''<br>
  '''VBA|VB.NET'''
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
{{APIComment|...'Add code to connect to a Synthesis repository.}}
   
   
  {{APIComment|'Check whether model #42 in project #1 is in use.}}
{{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}}
  MyRepository.Project.SetCurrentProject(1)   
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
 
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
  Dim CheckModel As Boolean
 
  CheckModel = MyRepository.Model.IsModelUsed(42)
  {{APIComment|'Check whether model #42 from project #1 is in use.}}
  {{APIPrefix|Dim}} CheckModel {{APIPrefix|As Boolean}}
  MyRepository.Project.SetCurrentProject(1)   
  CheckModel = MyRepository.Model.IsModelUsed(42)
   
   
  {{APIComment|'Output sample:}}
  {{APIComment|'Output sample.}}
  {{APIPrefix|If}} CheckModel = {{APIPrefix|True Then}}
  {{APIPrefix|If}} CheckModel = {{APIPrefix|True Then}}
    MsgBox ({{APIString|"The model is in use."}})
    MsgBox ({{APIString|"The model is in use."}})
  {{APIPrefix|Else}}
  {{APIPrefix|Else}}
    MsgBox ({{APIString|"The model is not in use."}})
    MsgBox ({{APIString|"The model is not in use."}})
  {{APIPrefix|End If}}
  {{APIPrefix|End If}}
</noinclude>

Latest revision as of 18:57, 8 April 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Checks whether the model is used by other items in the project. Returns a Boolean value; when true, indicates that the model is in use.

Syntax

.Model.IsModelUsed(ID)

Parameters

ID

Required. Integer. The ID number of the model to be checked.


Example

This example assumes that a model with ID #42 exists in the first available 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")
  
 'Check whether model #42 from project #1 is in use. 
  Dim CheckModel As Boolean
  MyRepository.Project.SetCurrentProject(1)  
  CheckModel = MyRepository.Model.IsModelUsed(42)

 'Output sample. 
  If CheckModel = True Then
    MsgBox ("The model is in use.")
  Else
    MsgBox ("The model is not in use.")
  End If