TeamInfo.SetCrewIDs Method: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 21: Line 21:
   MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr19"}})
   MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr19"}})
    
    
  {{APIComment|'Get crew #1 from project #1.}}
  {{APIComment|'Set the IDs for existing crews}}
   {{APIPrefix|Dim}} MyCrew {{APIPrefix|As}} cCrew
   {{APIPrefix|Dim}} CrewIDs() {{APIPrefix|As}} Long
   MyRepository.Project.SetCurrentProject(1)
   {{APIPrefix|ReDim}} CrewIDs(2)
   {{APIPrefix|Set}} MyCrew = MyRepository.Crew.GetCrew(1)
  CrewIDs(0) = 1
  CrewIDs(1) = 4
   CrewIDs(2) = 5
{{APIComment|'Create instance of TeamInfo.}}
  {{APIPrefix|Dim}} Team1 {{APIPrefix|As New}} TeamInfo
{{APIComment|'Set the crew IDs for Team1.}}
  {{APIPrefix|Call}} Team1.SetCrewIDS(CrewIDs)
   
   
  {{APIComment|'Add code to get an existing team.}}
  {{APIComment|'Do the same for another team.}}
  {{APIPrefix|Dim}} aTeam {{APIPrefix|As}} TeamInfo
  {{APIPrefix|ReDim}} CrewIDs(3)
{{APIComment|...}}
  CrewIDs(0) = 3
  CrewIDs(1) = 7
  CrewIDs(2) = 8
  CrewIDs(3) = 9
{{APIComment|'Create instance of TeamInfo.}}
  {{APIPrefix|Dim}} Team2 {{APIPrefix|As New}} TeamInfo
  {{APIComment|'Set the crew IDs for Team2.}}
  {{APIPrefix|Call}} Team2.SetCrewIDS(CrewIDs)
   
   
  {{APIComment|'Get the IDs of the crews assigned to the team.}}
  {{APIComment|'Get a particular task with ID of 2 from repository.}}
  {{APIPrefix|Dim}} myarray() {{APIPrefix|As integer}}
  {{APIPrefix|Dim}} aTask {{APIPrefix|As}} cCorrectiveTask
  {{APIPrefix|Call}} aTeam.GetCrewIDs(myarray)
  {{APIPrefix|Set}} aTask = MyRespository.Task.GetCorrectiveTask(2)
   
   
  {{APIComment|'Sample output.}}
  {{APIComment|'Put the teams previously created into array.}}
  {{APIPrefix|Dim}} i {{APIPrefix|As Integer}}
  {{APIPrefix|Dim}} Teams(1) {{APIPrefix|As}} TeamInfo
  {{APIPrefix|Dim}} upper {{APIPrefix|As Integer}}
  {{APIPrefix|Set}} Teams(0) = Team1
  {{APIPrefix|Dim}} lower {{APIPrefix|As Integer}}
  {{APIPrefix|Set}} Teams(1) = Team2
   
   
  lower = {{APIPrefix|LBound}}(myarray)
{{APIComment|'Assign teams to the task.}}
  upper = {{APIPrefix|UBound}}(myarray)
  {{APIPrefix|Call}} Task.SetTeams(Teams)
   
  {{APIComment|'Update task in repository.}}
  {{APIPrefix|For}} i = lower {{APIPrefix|To}} upper
  {{APIPrefix|Call}} MyRepository.Task.UpdateCorrectiveTask(Task)
  MsgBox "Crew ID = " & myarray(i)
  {{APIPrefix|Next}} i

Revision as of 16:06, 13 March 2019

APIWiki.png


Member of: SynthesisAPI.TeamInfo


Sets the IDs of the crews included in the team.


Remarks: Designed for VB6/VBA users, .NET users should use CrewIDs property instead.

Syntax

.SetCrewIDs(ByRef arr())

Parameters

arr()

Required as integer. An array of the crew IDs.

Example

VBA

 'Declare a new Repository object and connect to a Synthesis repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr19")
  
 'Set the IDs for existing crews 
  Dim CrewIDs() As Long
  ReDim CrewIDs(2)
  CrewIDs(0) = 1
  CrewIDs(1) = 4
  CrewIDs(2) = 5
 'Create instance of TeamInfo. 
  Dim Team1 As New TeamInfo
 'Set the crew IDs for Team1. 
  Call Team1.SetCrewIDS(CrewIDs)

 'Do the same for another team. 
  ReDim CrewIDs(3)
  CrewIDs(0) = 3
  CrewIDs(1) = 7
  CrewIDs(2) = 8
  CrewIDs(3) = 9
 'Create instance of TeamInfo. 
  Dim Team2 As New TeamInfo
  'Set the crew IDs for Team2. 
  Call Team2.SetCrewIDS(CrewIDs)

 'Get a particular task with ID of 2 from repository. 
  Dim aTask As cCorrectiveTask
  Set aTask = MyRespository.Task.GetCorrectiveTask(2)

 'Put the teams previously created into array. 
  Dim Teams(1) As TeamInfo
  Set Teams(0) = Team1
  Set Teams(1) = Team2

 'Assign teams to the task. 
  Call Task.SetTeams(Teams)
 'Update task in repository. 
  Call MyRepository.Task.UpdateCorrectiveTask(Task)