Difference between revisions of "CProfile.SetSegments"

From ReliaWiki
Jump to navigation Jump to search
Line 24: Line 24:
 
  {{APIComment|'Define two segments for the profile.}}
 
  {{APIComment|'Define two segments for the profile.}}
 
   {{APIPrefix|Dim}} segment {{APIPrefix|As}} SynthesisAPI.ProfileSegment
 
   {{APIPrefix|Dim}} segment {{APIPrefix|As}} SynthesisAPI.ProfileSegment
   {{APIPrefix|Dim}} ListofSegments(1) {{APIPrefix|As}} SynthesisAPI.ProfileSegment
+
   {{APIPrefix|Dim}} listOfSegments(1) {{APIPrefix|As}} SynthesisAPI.ProfileSegment
 
          
 
          
 
   {{APIPrefix|Set}} segment = {{APIPrefix|New}} SynthesisAPI.ProfileSegment
 
   {{APIPrefix|Set}} segment = {{APIPrefix|New}} SynthesisAPI.ProfileSegment
 
   segment.SegmentEnd = 1
 
   segment.SegmentEnd = 1
 
   segment.Value = 1
 
   segment.Value = 1
   {{APIPrefix|Set}} ListofSegments(0) = segment
+
   {{APIPrefix|Set}} listOfSegments(0) = segment
 
          
 
          
 
   {{APIPrefix|Set}} segment = {{APIPrefix|New}} SynthesisAPI.ProfileSegment
 
   {{APIPrefix|Set}} segment = {{APIPrefix|New}} SynthesisAPI.ProfileSegment
 
   segment.SegmentEnd = 3
 
   segment.SegmentEnd = 3
 
   segment.Value = "T+2"
 
   segment.Value = "T+2"
   {{APIPrefix|Set}} ListofSegments(1) = segment
+
   {{APIPrefix|Set}} listOfSegments(1) = segment
 
      
 
      
 
  {{APIComment|'Apply the segments to the profile.}}
 
  {{APIComment|'Apply the segments to the profile.}}
   myResource.SetSegments ListofSegments
+
   myResource.SetSegments listOfSegments
 
    
 
    
 
  {{APIComment|'Connect to a Synthesis repository.}}
 
  {{APIComment|'Connect to a Synthesis repository.}}
Line 46: Line 46:
 
   myRepository.Project.SetCurrentProject (1)
 
   myRepository.Project.SetCurrentProject (1)
 
   {{APIPrefix|Call}} myRepository.profile.AddProfile(myResource)
 
   {{APIPrefix|Call}} myRepository.profile.AddProfile(myResource)
 +
 +
'''VB.NET'''
 +
 +
{{APIComment|'Create a new resource profile and define its properties.}}
 +
  {{APIPrefix|Dim}} myResource {{APIPrefix|As New}} SynthesisAPI.cProfile({{APIString|"SampleProfile"}})
 +
  myResource.ProfileType = SynthesisAPI.ProfileTypeEnum.Stress
 +
  myResource.IsCyclical = True
 +
 +
{{APIComment|'Define two segments for the profile.}}
 +
  {{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|'Apply the segments to the profile.}}
 +
  myResource.SetSegments(listOfSegments)
 +
 +
{{APIComment|'Connect to a Synthesis repository.}}
 +
  {{APIPrefix|Dim}} myRepository {{APIPrefix|As New}} SynthesisAPI.Repository
 +
  myRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr11"}})
 +
 +
{{APIComment|'Add the profile to the first project in the repository.}}
 +
  myRepository.Project.SetCurrentProject(1)
 +
  myRepository.Profile.AddProfile(myResource)

Revision as of 17:49, 3 October 2016

APIWiki.png


Member of: SynthesisAPI.cProfile

DRAFT GRAY.png

WORK IN PROGRESS
CProfile.SetSegments

DRAFT GRAY.png


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)
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"}}

 'Apply 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)