Repository.Xfmea.AddItemToSystemHierarchy Method: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Template:API}}{{Template:APIBreadcrumb|10|.[[Repository Class|Repository]]}}
{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}}




<onlyinclude>Saves a new [[XfmeaItem Class|XfmeaItem]] object to the current project. Returns a '''Boolean''' value; when true, indicates a successful save.</onlyinclude>  
<onlyinclude>Adds a new system hierarchy item to the current project. Returns a '''Boolean''' value; when true, indicates a successful save.</onlyinclude>  


== Syntax ==
== Syntax ==
Line 9: Line 9:
=== Parameters ===
=== Parameters ===
''Item''
''Item''
:The [[XfmeaItem Class|XfmeaItem]] object to be added. (Required)
:Required. The [[XfmeaItem Class|XfmeaItem]] object that represents the system hierarchy item to be added.


''ParentID''
''ParentID''
:The record ID of the parent item. (Required)
:Required. Integer. The record ID of the parent item. The new system hierarchy item will be saved as a next level item under the parent item.
:The object will be saved as a next level item under the item with the specified record ID. You can view the record ID of all system hierarchy items by right-clicking the column headings, clicking '''Customize Columns''', and then selecting the '''Record ID''' check box.




== Example ==
== Example ==
This example assumes that a system hierarchy item with a record ID# 1 exists in the current project. The code creates a new system hierarchy item, and then saves it under the item with the said record ID.  
This example assumes that system hierarchy items exist in the first available project of repository. The code creates a new system hierarchy item, and then saves it to the repository.  
  '''VBA'''
  '''VBA'''
   
   
  {{APIComment|'Add code to connect to a Synthesis repository.}}
  {{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
  {{APIComment|...}}
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
 
  {{APIComment|'Create a new system hierarchy item. The following example creates an item called "NewSubsystem."}}
  {{APIComment|'Create a new system hierarchy item. The following example creates an item called "NewSubsystem."}}
  {{APIPrefix|Dim}} NewItem {{APIPrefix|As New}} XfmeaItem
  {{APIPrefix|Dim}} NewItem {{APIPrefix|As New}} XfmeaItem
  NewItem.Nm = {{APIString|"NewSubSystem"}}
  NewItem.Nm = {{APIString|"NewSubSystem"}}
   
   
  {{APIComment|'Add the new item to project #1 and position it under record ID #1.}}
  {{APIComment|'Add the new item to project #1 and position it under system hierarchy item #1.}}
{{APIComment|'The new item will be visible in the Synthesis repository upon refresh.}}
  MyRepository.Project.SetCurrentProject(1)   
  MyRepository.Project.SetCurrentProject(1)   
  {{APIPrefix|Call}} MyRepository.Xfmea.AddItemToSystemHierarchy(NewItem,1)
  {{APIPrefix|Call}} MyRepository.Xfmea.AddItemToSystemHierarchy(NewItem,1)


  '''VB.NET'''
  '''VB.NET'''
   
   
  {{APIComment|'Add code to connect to a Synthesis repository.}}
  {{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
  {{APIComment|...}}
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
   
   
  {{APIComment|'Create a new system hierarchy item. The following example creates an item called "NewSubsystem."}}
  {{APIComment|'Create a new system hierarchy item. The following example creates an item called "NewSubsystem."}}
  {{APIPrefix|Dim}} NewItem {{APIPrefix|As New}} XfmeaItem
  {{APIPrefix|Dim}} NewItem {{APIPrefix|As New}} XfmeaItem
  NewItem.Nm = {{APIString|"NewSubSystem"}}
  NewItem.Nm = {{APIString|"NewSubSystem"}}
   
   
  {{APIComment|'Add the new item to project #1 and position it under record ID #1.}}
  {{APIComment|'Add the new item to project #1 and position it under system hierarchy item #1.}}
{{APIComment|'The new item will be visible in the Synthesis repository upon refresh.}}
  MyRepository.Project.SetCurrentProject(1)   
  MyRepository.Project.SetCurrentProject(1)   
  MyRepository.Xfmea.AddItemToSystemHierarchy(NewItem,1)
  MyRepository.Xfmea.AddItemToSystemHierarchy(NewItem,1)

Latest revision as of 17:49, 9 June 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Adds a new system hierarchy item to the current project. Returns a Boolean value; when true, indicates a successful save.

Syntax

.Xfmea.AddItemToSystemHierarchy(Item, ParentID)

Parameters

Item

Required. The XfmeaItem object that represents the system hierarchy item to be added.

ParentID

Required. Integer. The record ID of the parent item. The new system hierarchy item will be saved as a next level item under the parent item.


Example

This example assumes that system hierarchy items exist in the first available project of repository. The code creates a new system hierarchy item, and then saves it to the 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 system hierarchy item. The following example creates an item called "NewSubsystem." 
  Dim NewItem As New XfmeaItem
  NewItem.Nm = "NewSubSystem"

 'Add the new item to project #1 and position it under system hierarchy item #1. 
  MyRepository.Project.SetCurrentProject(1)   
  Call MyRepository.Xfmea.AddItemToSystemHierarchy(NewItem,1)
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 system hierarchy item. The following example creates an item called "NewSubsystem." 
  Dim NewItem As New XfmeaItem
  NewItem.Nm = "NewSubSystem"

 'Add the new item to project #1 and position it under system hierarchy item #1. 
  MyRepository.Project.SetCurrentProject(1)   
  MyRepository.Xfmea.AddItemToSystemHierarchy(NewItem,1)