CProfile.SetSegments: Difference between revisions
Jump to navigation
Jump to search
Kate Racaza (talk | contribs) No edit summary |
Kate Racaza (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:cProfile.SetSegments}}{{Template:API}}{{Template:APIBreadcrumb|.[[CProfile_Class|cProfile]] | {{DISPLAYTITLE:cProfile.SetSegments}}{{Template:API}}{{Template:APIBreadcrumb|.[[CProfile_Class|cProfile]]}} | ||
<onlyinclude>Adds | <onlyinclude>Adds segments to the profile.</onlyinclude> | ||
== Syntax == | == Syntax == | ||
Line 36: | Line 36: | ||
{{APIPrefix|Set}} listOfSegments(1) = segment | {{APIPrefix|Set}} listOfSegments(1) = segment | ||
{{APIComment|' | {{APIComment|'Add the segments to the profile.}} | ||
myResource.SetSegments listOfSegments | myResource.SetSegments listOfSegments | ||
Line 55: | Line 55: | ||
{{APIComment|'Define two segments for the profile.}} | {{APIComment|'Define two segments for the profile.}} | ||
{{APIPrefix|Dim}} listOfSegments() {{APIPrefix|As}} SynthesisAPI.ProfileSegment _ | {{APIPrefix|Dim}} listOfSegments() {{APIPrefix|As}} SynthesisAPI.ProfileSegment = _ | ||
{{{APIPrefix|New}} SynthesisAPI.ProfileSegment {{APIPrefix|With}} {.SegmentEnd = 1, .Value = 1}, _ | |||
{{APIPrefix|New}} SynthesisAPI.ProfileSegment {{APIPrefix|With}} {.SegmentEnd = 3, .Value = {{APIString|"T+2"}}}} | |||
{{APIComment|' | {{APIComment|'Add the segments to the profile.}} | ||
myResource.SetSegments(listOfSegments) | myResource.SetSegments(listOfSegments) | ||
Latest revision as of 22:18, 22 March 2017
Member of: SynthesisAPI.cProfile
Adds segments 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 'Add 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)
VB.NET 'Create a new resource profile and define its properties. Dim myResource As New SynthesisAPI.cProfile("SampleProfile") myResource.ProfileType = SynthesisAPI.ProfileTypeEnum.Stress myResource.IsCyclical = True 'Define two segments for the profile. Dim listOfSegments() As SynthesisAPI.ProfileSegment = _ {New SynthesisAPI.ProfileSegment With {.SegmentEnd = 1, .Value = 1}, _ New SynthesisAPI.ProfileSegment With {.SegmentEnd = 3, .Value = "T+2"}} 'Add the segments to the profile. myResource.SetSegments(listOfSegments) 'Connect to a Synthesis repository. Dim myRepository As New SynthesisAPI.Repository myRepository.ConnectToAccessRepository("C:\RSRepository1.rsr11") 'Add the profile to the first project in the repository. myRepository.Project.SetCurrentProject(1) myRepository.Profile.AddProfile(myResource)