CScheduledTask.OnCondSetTeams Method: Difference between revisions
Jump to navigation
Jump to search
(Created page with '{{DISPLAYTITLE:cScheduledTask.OnCondSetTeams Method}}{{Template:API}}{{Template:APIBreadcrumb|.cScheduledTask}} <onlyinclude>Sets the teams required fo…') |
No edit summary |
||
Line 16: | Line 16: | ||
== Example == | == Example == | ||
'''VBA''' | '''VBA''' | ||
{{APIComment|'Declare a new Repository object and connect to a repository.}} | |||
{{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | |||
MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr19"}}) | |||
MyRepository.Project.SetCurrentProject(1) | |||
{{APIComment|'Set the IDs for existing crews}} | |||
{{APIPrefix|Dim}} CrewIDs() {{APIPrefix|As}} Long | |||
{{APIPrefix|ReDim}} CrewIDs(2) | |||
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|'Do the same for another team.}} | |||
{{APIPrefix|ReDim}} CrewIDs(3) | |||
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 a particular task with ID of 2 from repository.}} | |||
{{APIPrefix|Dim}} aTask {{APIPrefix|As}} cScheduledTask | |||
{{APIPrefix|Set}} aTask = MyRespository.Task.GetScheduledTask(2) | |||
{{APIPrefix|If}} aTask.TaskClass = TaskClassEnum_OnCondition {{APIPrefix|Then}} | |||
{{APIComment|'Put the teams previously created into array.}} | |||
{{APIPrefix|Dim}} Teams(1) {{APIPrefix|As}} TeamInfo | |||
{{APIPrefix|Set}} Teams(0) = Team1 | |||
{{APIPrefix|Set}} Teams(1) = Team2 | |||
{{APIComment|'Assign teams to the task.}} | |||
{{APIPrefix|Dim}} Teams() {{APIPrefix|As}} TeamInfo | |||
{{APIPrefix|Call}} Task.OnCondSetTeams(Teams) | |||
{{APIPrefix|End If}} |
Latest revision as of 22:40, 13 March 2019
Member of: SynthesisAPI.cScheduledTask
Sets the teams required for the 'On condition' task.
Remarks: Designed for VB6/VBA users, but can also be used in .NET. Alternatively, .NET users can use the OnCondTeams()
property in the class to get or set the teams.
Syntax
.OnCondSetTeams(ByRef arr())
Parameters
arr()
- Required as TeamInfo. An array of the team IDs for the task.
Example
VBA 'Declare a new Repository object and connect to a repository. Dim MyRepository As New Repository MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr19") MyRepository.Project.SetCurrentProject(1) '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 cScheduledTask Set aTask = MyRespository.Task.GetScheduledTask(2) If aTask.TaskClass = TaskClassEnum_OnCondition Then '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. Dim Teams() As TeamInfo Call Task.OnCondSetTeams(Teams) End If