AddConstant(ConstantValue: Variant): ITimeSeries;
AddConstant(ConstantValue: object): Prognoz.Platform.Interop.Ms.TimeSeries;
ConstantValue. Value of constant.
The AddConstant method adds a constant to matrix.
To add a series to matrix, use the IMsTimeMatrix.AddSerie method.
This example describes custom method.
To execute the example, add links to the Ms, Dimensions system assemblies.
Public Function CreateLevel(param: IMsTimeMatrix): Variant;
Var
m : IMsTimeMatrix;
i, j: Integer;
s : String;
serie : ITimeSeries;
Begin
m := New MsTimeMatrix.CreateLevel(DimCalendarLevel.Year);
m.AddConstant(13);
m.AddConstant(5);
If param.StartDate = DateTime.ComposeDay(2014,7,8) Then
Debug.WriteLine("Series: " + m.Count.ToString);
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);
End For;
End If;
Return m;
End Function CreateLevel;
The method adds constants to matrix. After that the console window displays resulting matrix series.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Fore;
…
Public Function CreateLevel(param: IMsTimeMatrix): object;
Var
m : IMsTimeMatrix;
DateTime: DateTimeClassClass;
i, j: Integer;
s : String;
serie : ITimeSeries;
Begin
m.CreateLevel(DimCalendarLevel.dclYear, Null);
m.AddConstant(13);
m.AddConstant(5);
If param.StartDate = DateTime.ComposeDay(2014,7,8) Then
System.Diagnostics.Debug.WriteLine("Series: " + m.Count.ToString());
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;
System.Diagnostics.Debug.WriteLine("Series: " + i.ToString() + " - " + s);
End For;
End If;
Return m;
End Function CreateLevel;
See also: