IEmSeries.AddComputingSerie

Fore syntax

AddComputingSerie(
    Name: String;
    DisplayName: String;
    BaseSerieName: String;
    Type: EmComputingSerieType;
    Condition: Variant): IEmComputingSerie;

Fore.NET syntax

AddComputingSerie(
    Name: string;
    DisplayName: string;
    BaseSerieName: string;
    Type: Prognoz.Platform.Interop.Modeller.EmComputingSerieType;
    Condition: object): Prognoz.Platform.Interop.Modeller.IEmComputingSerie;

Parameters

Name. Calculated series identifier.

DisplayName. Calculated series name.

BaseSerieName. Series identifier, based on its values calculated series is calculated.

Type. Series values calculation method.

Condition. Series values calculation parameter.

Description

The AddComputingSerie method adds a calculated series to the express modeling source series.

Comments

Features of the method use, depending on the Type parameter value:

Fore example

To execute the example, add a link to the Modeller system assembly.

Sub CompSerie;
Var
    ExprMod: IExpressModeller;
    Ar: Array[6Of Double;
    Series: IEmSeries;
    Serie: IEmSerie;
    CSerie: IEmComputingSerie;
Begin
    ExprMod := New ExpressModeller.Create;
    Ar[0] := 56; Ar[2] := 45; Ar[3] := 23; Ar[4] := 45;
    Ar[1] := Double.Nan; Ar[5] := Double.Nan;
    Series := ExprMod.Series;
    // Adding data series
    Serie := Series.Add(Ar, "X1""Initial series");
    // Deducting its values
    Debug.WriteLine("Initial data series:");
    PrintSerie(Serie);
    // Adding calculated data series
    CSerie := Series.AddComputingSerie("F1""Initial series ( considering lag)""X1", EmComputingSerieType.Lag, 1);
    // Deducting its values
    Debug.WriteLine("Initial data series ( considering lag):");
    PrintSerie(CSerie As IEmSerie);
    // Modifying calculated series formula
    CSerie.BaseName := "";
    CSerie.Name := "F2";
    CSerie.DisplayName := "Expanded data series";
    CSerie.Type := EmComputingSerieType.User;
    CSerie.Condition := "X1+6";
    // Deducting its modified values
    Debug.WriteLine("Expanded initial data series:");
    PrintSerie(CSerie As IEmSerie);
End Sub CompSerie;

// Series values output procedure
Sub PrintSerie(Serie: IEmSerie);
Var
    i: Integer;
Begin
    Debug.Indent;
    If Serie.Count > 0 Then
        For i := 0 To Serie.Count - 1 Do
            Debug.WriteLine(Serie.Item(i));
        End For;
    Else
        Debug.WriteLine("Data series is empty");
    End If;
    Debug.Unindent;
End Sub PrintSerie;

Example execution result: simple data series is added to the initial data, its values are displayed in the console window. Based on this series calculated series is created, and its values are displayed in the console window. Then calculated series calculation formula is changed, and its new values are displayed in the console window.

Fore.NET example

Imports Prognoz.Platform.Interop.Modeller;

Public Shared Sub CompSerie();
Var
    ExprMod: IExpressModeller;
    Ar: Array[6Of Double;
    Series: IEmSeries;
    Serie: IEmSerie;
    CSerie: IEmComputingSerie;
Begin
    ExprMod := New ExpressModeller.Create();
    Ar[0] := 56; Ar[2] := 45; Ar[3] := 23; Ar[4] := 45;
    Ar[1] := Double.Nan; Ar[5] := Double.Nan;
    Series := ExprMod.Series;
    // Adding data series
    Serie := Series.Add(Ar, "X1""Initial series");
    // Deducting its values
    System.Diagnostics.Debug.WriteLine("Initial data series:");
    PrintSerie(Serie);
    // Adding calculated data series
    CSerie := Series.AddComputingSerie("F1""Initial series ( considering lag)""X1", EmComputingSerieType.Lag, 1);
    // Deducting its values
    System.Diagnostics.Debug.WriteLine("Initial data series ( considering lag):");
    PrintSerie(CSerie As IEmSerie);
    // Modifying calculated series formula   
    CSerie.BaseName := "";
    CSerie.Name_2 := "F2";
    CSerie.DisplayName_2 := "Expanded data series";
    CSerie.Type := EmComputingSerieType.cstUser;
    CSerie.Condition := "X1+6";
    // Deducting its modified values
    System.Diagnostics.Debug.WriteLine("Expanded initial data series:");
    PrintSerie(CSerie As IEmSerie);
End Sub CompSerie;

// Series values output procedure
Public Shared Sub PrintSerie(Serie: IEmSerie);
Var
    i: Integer;
Begin
    System.Diagnostics.Debug.Indent();
    If Serie.Count > 0 Then
        For i := 0 To Serie.Count - 1 Do
            System.Diagnostics.Debug.WriteLine(Serie.Item[i]);
        End For;
    Else
        System.Diagnostics.Debug.WriteLine("Data series is empty");
    End If;
    System.Diagnostics.Debug.Unindent();
End Sub PrintSerie;

Example execution result: simple data series is added to the initial data, its values are displayed in the console window. Based on this series calculated series is created, and its values are displayed in the console window. Then calculated series calculation formula is changed, and its new values are displayed in the console window.

See also:

IEmSeries