Repository.Xfmea.AssignActionToXfmeaCause Method: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{Template:API}}{{Template:APIBreadcrumb|.Repository}} <onlyinclude>Assigns an action to a cause. Returns a '''Boolean''' value; when true, indicates the a…')
 
No edit summary
Line 14: Line 14:


== Example ==
== Example ==
This example assumes that a function with ID #1 exists in the first available project of a repository.


  '''VBA'''
  '''VBA|VB.NET'''
   
   
  {{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}}
  {{APIComment|'Declare a new Repository object and connect to a repository.}}
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
   MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
   MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr11"}})
    
    
  {{APIComment|'Get FMEA function #1 from project #1.}}
  {{APIComment|'Get a list of actions from project #1.}}
   {{APIPrefix|Dim}} MyFunction {{APIPrefix|As}} XfmeaFunction
   {{APIPrefix|Dim}} MyFunction {{APIPrefix|As}} XfmeaFunction
  {{APIPrefix|Dim}} Actions() {{APIPrefix|As}} cAction
   MyRepository.Project.SetCurrentProject(1)
   MyRepository.Project.SetCurrentProject(1)
   {{APIPrefix|Set}} MyFunction = MyRepository.Xfmea.GetXfmeaFunction(1)
   {{APIPrefix|Set}} Actions = MyRepository.Action.GetAllActions()
{{APIComment|'Change the FMEA function's description to "New_Description."}}
  MyFunction.Dsc = {{APIString|"New_Description"}}
{{APIComment|'Send the change to the Synthesis repository.}}
  {{APIPrefix|Call}} MyRepository.Xfmea.UpdateXfmeaFunction(MyFunction)
 
'''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|'Get FMEA function #1 from project #1.}}
  {{APIComment|'Get a list of causes for failure #1 from project #1.}}
   {{APIPrefix|Dim}} MyFunction {{APIPrefix|As}} XfmeaFunction
   {{APIPrefix|Dim}} Causes() {{APIPrefix|As}} cCause
   MyRepository.Project.SetCurrentProject(1)
   {{APIPrefix|Set}} Causes = MyRepository.Xfmea.GetAllXfmeaCauses(1)
  MyFunction = MyRepository.Xfmea.GetXfmeaFunction(1)
{{APIComment|'Change the FMEA function's description to "New_Description."}}
  MyFunction.Dsc = {{APIString|"New_Description"}}
   
   
  {{APIComment|'Send the change to the Synthesis repository.}}
  {{APIComment|'Assign the first item in the Actions array to be assigned to the first item in the Causes array. For VB.NET, dictionaries could also be used.}}
   MyRepository.Xfmea.UpdateXfmeaFunction(MyFunction)
   {{APIPrefix|Dim}} bOK {{APIPrefix|As}} Boolean
  bOK = MyRepository.Xfmea.AssignActionToXfmeaCause(Actions(0), Causes(0))

Revision as of 23:57, 1 March 2018

APIWiki.png


Member of: SynthesisAPI.Repository


Assigns an action to a cause. Returns a Boolean value; when true, indicates the action was assigned successfully.

Syntax

.Xfmea.AssignActionToXfmeaCause(ActionID, CauseID)

Parameters

Action ID

Required. The Action ID of the action that is to be assigned to the cause.

Cause ID

Required. The Cause ID of the cause to which the action is to be assigned.

Example

VBA|VB.NET

 'Declare a new Repository object and connect to a repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr11")
  
 'Get a list of actions from project #1. 
  Dim MyFunction As XfmeaFunction
  Dim Actions() As cAction
  MyRepository.Project.SetCurrentProject(1)
  Set Actions = MyRepository.Action.GetAllActions()
  
 'Get a list of causes for failure #1 from project #1. 
  Dim Causes() As cCause
  Set Causes = MyRepository.Xfmea.GetAllXfmeaCauses(1)

 'Assign the first item in the Actions array to be assigned to the first item in the Causes array. For VB.NET, dictionaries could also be used. 
  Dim bOK As Boolean
  bOK = MyRepository.Xfmea.AssignActionToXfmeaCause(Actions(0), Causes(0))