Difference between revisions of "Repository.Pool.AddPool"

From ReliaWiki
Jump to navigation Jump to search
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
+
{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}}
  
== Method Syntax==
 
{{APIName|AddPool(}}
 
{{APIPrefix|ByVal}}
 
{{APIName|pool}}
 
{{APIPrefix|As}}
 
{{APIName|[[cPool Class|cPool]])}}
 
{{APIPrefix|As Boolean}}<br>
 
{{APIComment|Saves the spare parts pool in the repository. }}
 
  
== Parameters ==
+
<onlyinclude>Adds a new spare part pool to the current project. Returns a '''Boolean''' value; when true, indicates indicates a successful save.</onlyinclude>
'''pool'''
 
{{APIComment|The pool to add to the repository.}}
 
  
== Usage Example ==
 
{{APIComment|Declare a new repository connection class.}}
 
        Private WithEvents MyRepository As New Repository
 
  
{{APIComment|Connect to the Synthesis repository.}}
+
'''Remarks''': If a pool with the same name already exists in the destination project, the name will be incremented automatically. For example, if "Pool1" already exists, the new pool might be renamed to "Pool2," "Pool3," etc.
        Dim Success As Boolean = False
 
        Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
 
  
{{APIComment|Declare a new Pool.}}
+
== Syntax ==
        Dim newPool As New cPool("NewPool1")
+
'''.Pool.AddPool'''(''pool'')
  
{{APIComment|Add the Pool to the repository.}}
+
=== Parameters ===
        Dim SuccessAddPool As Boolean
+
''pool''
        SuccessAddPool = MyRepository.AddPool(newPool)
+
:Required. The [[CPool Class|cPool]] object that represents the spare part pool to be added.
 +
 
 +
 
 +
== Example ==
 +
This example creates a new spare part pool resource, and then saves it in the first available project in a Synthesis repository.
 +
'''VBA'''
 +
 +
{{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}}
 +
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
 +
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
 +
 
 +
{{APIComment|'Create a new pool. The following example creates a pool named "MyNewSpares."}}
 +
  {{APIPrefix|Dim}} NewSpares {{APIPrefix|As New}} cPool
 +
  NewSpares.Name = {{APIString|"MyNewSpares"}}
 +
 +
{{APIComment|'Add the new spare part pool to project #1.}}
 +
  MyRepository.Project.SetCurrentProject(1) 
 +
  {{APIPrefix|Call}} MyRepository.Pool.AddPool(NewSpares)
 +
 
 +
'''VB.NET'''
 +
 +
{{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}}
 +
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
 +
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
 +
 +
{{APIComment|'Create a new pool. The following example creates a pool named "MyNewSpares."}}
 +
  {{APIPrefix|Dim}} NewSpares {{APIPrefix|As New}} cPool ({{APIString|"MyNewSpares"}})
 +
 +
{{APIComment|'Add the new spare part pool to project #1.}}
 +
  MyRepository.Project.SetCurrentProject(1) 
 +
  MyRepository.Pool.AddPool(NewSpares)

Latest revision as of 20:35, 18 August 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Adds a new spare part pool to the current project. Returns a Boolean value; when true, indicates indicates a successful save.


Remarks: If a pool with the same name already exists in the destination project, the name will be incremented automatically. For example, if "Pool1" already exists, the new pool might be renamed to "Pool2," "Pool3," etc.

Syntax

.Pool.AddPool(pool)

Parameters

pool

Required. The cPool object that represents the spare part pool to be added.


Example

This example creates a new spare part pool resource, and then saves it in the first available project in 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")
 
 'Create a new pool. The following example creates a pool named "MyNewSpares." 
  Dim NewSpares As New cPool
  NewSpares.Name = "MyNewSpares"

 'Add the new spare part pool to project #1. 
  MyRepository.Project.SetCurrentProject(1)   
  Call MyRepository.Pool.AddPool(NewSpares)
VB.NET

 'Declare a new Repository object and connect to a Synthesis repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr10")

 'Create a new pool. The following example creates a pool named "MyNewSpares." 
  Dim NewSpares As New cPool ("MyNewSpares")

 'Add the new spare part pool to project #1. 
  MyRepository.Project.SetCurrentProject(1)   
  MyRepository.Pool.AddPool(NewSpares)