IMsTimeMatrix.AddTerm

Fore Syntax

AddTerm(TermValue: IMsFormulaTerm): ITimeSeries;

Fore.NET Syntax

AddTerm(TermValue: Prognoz.Platform.Interop.Ms.IMsFormulaTerm): Prognoz.Platform.Interop.Ms.TimeSeries;

Parameters

TermValue. Term value.

Description

The AddTerm method adds a term to matrix.

Comments

To add a series to matrix, use the IMsTimeMatrix.AddSerie method.

Fore Example

This example describes custom method.

To execute the example, add links to the Ms system assemblies.

Public Function Create(param: ITimeSeries): Variant;
Var 
    m : IMsTimeMatrix;
    Term: IMsFormulaTerm;
    i, j: Integer;
    s : String;
    serie : ITimeSeries;
Begin
    m := New MsTimeMatrix.Create;
    If param.CurrentDate < DateTime.Now Then
        Debug.WriteLine("Series - " + m.Count.ToString);
        Term := param.Item(i);
        m.AddTerm(Term);
        For i := 0 To m.Count - 1 Do
            s := "";
            serie := m.Item(i);
            For j := m.StartIndex To m.EndIndex Do
                s := s + (serie.Item(j) As double).ToString + " ";
            End For;
            Debug.WriteLine("Series: " + i.ToString + " - " + s);
            Debug.WriteLine("Number of points between indexes of series start and end: "
                + m.CalcPointCount.ToString);
        End For;
    End If;
    Return m;
End Function Create;

The method adds terms to matrix. After that the console window displays resulting matrix series and the number of points between indexes of series start and end.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Ms;

Public Function Create(param: ITimeSeries): object;
Var 
    m : IMsTimeMatrix;
    Term: IMsFormulaTerm;
    i, j: Integer;
    s : String;
    serie : ITimeSeries;
Begin
    m := New MsTimeMatrix.Create(); 
    If param.CurrentDate < DateTime.Now Then
        System.Diagnostics.Debug.WriteLine("Series - " + m.Count.ToString());
        For i := 0 To m.Count - 1 Do
            Term := param.Item[i] As IMsFormulaTerm;
            m.AddTerm(Term);
            s := "";
            serie := m.Item[i];
            For j := m.StartIndex To m.EndIndex Do
                s := s + (serie.Item[j] As double).ToString() + " ";
            End For;
            System.Diagnostics.Debug.WriteLine("Series: " + i.ToString() + " - " + s);
            System.Diagnostics.Debug.WriteLine("Number of points between indexes of series start and end: "
                + m.CalcPointCount.ToString());
        End For;
    End If;
    Return m;
End Function Create;

See also:

IMsTimeMatrix