Time([StartDate: String = "";][CustomFrequency: MsFrequency = 0]): Variant;
Time(StartDate: string;
CustomFrequency: Prognoz.Platform.Interop.Ms.MsFrequancy;
Context: Prognoz.Platform.Interop.Fore.IForeRuntimeContext): object;
StartDate. A reference date that is used to create values. Observation at this point has zero value. Optional parameter. The default value corresponds with the start date of the model sample period.
CustomFrequency. The frequency, which values are created. Optional parameter.By default, the frequency is undefined and matches the model frequency.
Context. Context. It is applied only in Fore.NET.
The Time method returns the time series, which value increases by 1 for each successive observation.
The Time temporary variable can contain positive and negative values. Assume that start date of the model sample period is 01.01.2003, end date is 01.01.2009. The value of the StartDate parameter is 01.01.2006. The variable will contain the following values:
Year |
2003 |
2004 |
2005 |
2006 |
2007 |
2008 |
2009 |
Time value |
-3 |
-2 |
-1 |
0 |
1 |
2 |
3 |
Executing the example requires a modeling container with the CONT_MODEL identifier that contains a determinate equation model with the DUMMIS_DETERM identifier. Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
Transf: IMsFormulaTransform;
Determ: IMsDeterministicTransform;
Begin
mb := MetabaseClass.Active;
MsDescr := mb.ItemById("CONT_MODEL");
Model := mb.ItemByIdNamespace("DUMMIES_DETERM", MsDescr.Key).Edit As IMsModel;
Transf := Model.Transform;
Determ := Transf.FormulaItem(0).Method As IMsDeterministicTransform;
Determ.Expression.AsString := "Time(""" + "01.01.2006" + """)";
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the time variable is used in the model equation.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
MsDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
Transf: IMsFormulaTransform;
Determ: IMsDeterministicTransform;
Begin
mb := Params.Metabase;
MsDescr := mb.ItemById["CONT_MODEL"];
Model := mb.ItemByIdNamespace["DUMMIES_DETERM", MsDescr.Key].Edit() As IMsModel;
Transf := Model.Transform;
Determ := Transf.FormulaItem[0].Method As IMsDeterministicTransform;
Determ.Expression.AsString := "Time(""" + "01.01.2006" + """)";
(Model As IMetabaseObject).Save();
End Sub;
See also: