This method will set the series size of a manually sized and manually indexed series of floating numbers or strings.  


Two Column Number Series:

1)Selecting either the Number or String data-type option available in the IPV and BPV variable creation dialog.  

2)Disable the default "Auto-Index -- Uses [n] as Lookback from Current Day"

3)When the "Auto-Index" option is disabled, the series will be a "Manual Index" series with 100 rows.

4)If you know the number of rows will be different, you can change them now, or change is scripting using this topic's function.

All Manual-Indexed series have a minimum size of 1, and a maximum size of 1,000,000 elements.  Do not attempt to access a manual series element location with an index value less than 1, or greater than the actual size of the series.  

Series index number violations will errors that will stop execution.

Manual series created with the default or any other value can be re-sized using this function.  

Size of a series can be obtained by using the GetSeriesSize function.  

This function can be used to increase or decrease the size of a manually Indexed series.

When a manual series size is changed, the values currently in the series row location are retained.

When rows are removed, the values in the removed rows will be deleted.

When the size is increased, the new element rows are initialize with the default value shown in series creation dialog.


Two-Column Series Note:

A manually indexed single column number series can have two columns.  To add a column to one column series, use the SetSeriesSize [optional] parameter (  See "Add Column Example" ).



SetSeriesSize( SeriesName, column_1_Size, [column_2_Size] )





Adjust size series name.


New series size integer value.


Optional second series integer size.


Example - One Column Series:

VARIABLES: seriesSize   TYPE: integer
' Get the current series size.
seriesSize = GetSeriesSize( instrument.myCustomSeries )
' If we don't have enough space, then resize.
' Make bigger than necessary so we don't have to do this every time.
IF index > seriesSize THEN
  SetSeriesSize( instrument.myCustomSeries, index + 10 )
' Set the value into the series.
instrument.myCustomSeries[ index ] = someNumber

Return - One Column Series:

SetSeriesSize doesn't return any value, but the size of a series can be obtained using the GetSeriesSize function.

Example - Add Column Example:

'  --------------------------------------------------------------
'  Convert a One-Column Number Series to a Two-Column Series
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VARIABLES: iSeriesSize, iColumn_1_Size, iColumn_2_Size Type: Integer
'  --------------------------------------------------------------
'  Help File Function Statement
'     SetSeriesSize( SeriesName, column_1_Size, [column_2_Size] )
'  --------------------------------------------------------------
'  Reset Working Variables
iSeriesSize = 0
iColumn_1_Size = 10
iColumn_2_Size = 10
'  --------------------------------------------------------------
'  Discover Current Size of a Manual Series
iSeriesSize = GetSeriesSize( aNumeric2ColSeries )
'  Report Manual Series Size
PRINT "Original iSeriesSize = ", iSeriesSize
'  --------------------------------------------------------------
PRINT "Change a One-Column Series to a Two-Column Series"
'  Add a second column to the Manual Number Series
SetSeriesSize( aNumeric2ColSeries, iColumn_1_Size, iColumn_2_Size )
'  --------------------------------------------------------------
'  Discover Current Size of a Manual Series
iSeriesSize = GetSeriesSize( aNumeric2ColSeries )
'  Report Manual Series Size
PRINT "After iSeriesSize = ", iSeriesSize
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'  --------------------------------------------------------------

Return - Add Column Example:

Original iSeriesSize =  100


Change a One-Column Series to a Two-Column Series

After iSeriesSize =  10



GetSeriesSize, SetSeriesValue

See Also:

Series Functions


Edit Time: 5/10/2017 10:37:04 AM

Topic ID#: 556


Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software