CProfile.SetSegments: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{DISPLAYTITLE:cProfile.SetSegments}}{{Template:API}}{{Template:APIBreadcrumb|.cProfile}} <onlyinclude>Adds a new segment to the profile.</onlyinclude> == S…')
 
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:cProfile.SetSegments}}{{Template:API}}{{Template:APIBreadcrumb|.[[CProfile_Class|cProfile]]}}
{{DISPLAYTITLE:cProfile.SetSegments}}{{Template:API}}{{Template:APIBreadcrumb|.[[CProfile_Class|cProfile]]}}{{InProgress}}




Line 13: Line 13:


== Example ==
== Example ==
'''VBA'''
{{APIComment|'Create a new resource profile and define its properties.}}
  {{APIPrefix|Dim}} myResource {{APIPrefix|As New}} SynthesisAPI.cProfile
  myResource.Name = {{APIString|"SampleProfile"}}
  myResource.ProfileType = ProfileTypeEnum_Stress
  myResource.IsCyclical = True
 
{{APIComment|'Define two segments for the profile.}}
  {{APIPrefix|Dim}} segment {{APIPrefix|As}} SynthesisAPI.ProfileSegment
  {{APIPrefix|Dim}} ListofSegments(1) {{APIPrefix|As}} SynthesisAPI.ProfileSegment
       
  {{APIPrefix|Set}} segment = {{APIPrefix|New}} SynthesisAPI.ProfileSegment
  segment.SegmentEnd = 1
  segment.Value = 1
  {{APIPrefix|Set}} ListofSegments(0) = segment
       
  {{APIPrefix|Set}} segment = {{APIPrefix|New}} SynthesisAPI.ProfileSegment
  segment.SegmentEnd = 3
  segment.Value = "T+2"
  {{APIPrefix|Set}} ListofSegments(1) = segment
   
{{APIComment|'Apply the segments to the profile.}}
  myResource.SetSegments ListofSegments
 
{{APIComment|'Connect to a Synthesis repository.}}
  {{APIPrefix|Dim}} myRepository {{APIPrefix|As New}} Repository
  myRepository.ConnectToAccessRepository ({{APIString|"C:\RSRepository1.rsr11"}})
 
{{APIComment|'Add the profile to the first project in the repository.}}
  myRepository.Project.SetCurrentProject (1)
  {{APIPrefix|Call}} myRepository.profile.AddProfile(myResource)

Revision as of 16:46, 3 October 2016

APIWiki.png


Member of: SynthesisAPI.cProfile Template:InProgress


Adds a new segment to the profile.

Syntax

.SetSegment(ByRef arr()) 

Parameters

arr

Required. An array of ProfileSegment objects.


Example

VBA

 'Create a new resource profile and define its properties. 
  Dim myResource As New SynthesisAPI.cProfile
  myResource.Name = "SampleProfile"
  myResource.ProfileType = ProfileTypeEnum_Stress
  myResource.IsCyclical = True
 
 'Define two segments for the profile. 
  Dim segment As SynthesisAPI.ProfileSegment
  Dim ListofSegments(1) As SynthesisAPI.ProfileSegment
       
  Set segment = New SynthesisAPI.ProfileSegment
  segment.SegmentEnd = 1
  segment.Value = 1
  Set ListofSegments(0) = segment
       
  Set segment = New SynthesisAPI.ProfileSegment
  segment.SegmentEnd = 3
  segment.Value = "T+2"
  Set ListofSegments(1) = segment
   
 'Apply the segments to the profile. 
  myResource.SetSegments ListofSegments
 
 'Connect to a Synthesis repository. 
  Dim myRepository As New Repository
  myRepository.ConnectToAccessRepository ("C:\RSRepository1.rsr11")
 
 'Add the profile to the first project in the repository. 
  myRepository.Project.SetCurrentProject (1)
  Call myRepository.profile.AddProfile(myResource)