OutputPeriod: IMsPeriod;
OutputPeriod: Prognoz.Platform.Interop.Ms.IMsPeriod;
The OutputPeriod property returns data unloading period parameters
To set up parameters of model calculation period, use the IMsFormulaTransform.Period property.
Executing the example requires that the repository contains a modeling container with the MS identifier. The container must contain metamodel with the METAMODEL_TRANSF_OUTPUT identifier including in calculation chain model with the MODEL_TRANSF_OUTPUT identifier.
Add links to the Dal, Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
MetaModel: IMsMetaModel;
pParams: IMsModelParams;
pPar: IMsModelParam;
pModel: IMsModel;
pPeriod: IMsDatePeriod;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get metamodel
MetaModel := mb.ItemByIdNamespace("METAMODEL_TRANSF_OUTPUT", MsKey).Edit As IMsMetaModel;
// Get metamodel parameters
pParams := MetaModel.Params;
// Remove all parameters
pParams.Clear;
// Add metamodel parameter to set start of data downloading period
pPar := pParams.Add;
pPar.Id := "OUT_START";
pPar.Name := "Data downloading start";
pPar.DataType := DbDataType.Date;
pPar.DefaultValue := DateTime.Parse("01.01.2018");
// Add metamodel parameter to set data downloading period end
pPar := pParams.Add;
pPar.Id := "OUT_END";
pPar.Name := "Data downloading end";
pPar.DataType := DbDataType.Date;
pPar.DefaultValue := DateTime.Parse("01.01.2020");
// Save changes of the metamodel
(MetaModel As IMetabaseObject).Save;
// Get the model
pModel := mb.ItemByIdNamespace("MODEL_TRANSF_OUTPUT", MsKey).Edit As IMsModel;
// Get model calculation period parameters
pPeriod := pModel.Transform.OutputPeriod As IMsDatePeriod;
pPeriod.ClearPeriod;
// Set model parameters determining start and end of data downloading period
pPeriod.StartParamID := "OUT_START";
pPeriod.EndParamID := "OUT_END";
// Save changes in the model
(pModel As IMetabaseObject).Save;
End Sub UserProc;
After executing the example start and end of model data downloading period will be set by the OUT_START and OUT_END parameters.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
MsKey: uinteger;
MetaModel: IMsMetaModel;
pParams: IMsModelParams;
pPar: IMsModelParam;
pModel: IMsModel;
pPeriod: IMsDatePeriod;
Begin
// Get current repository
mb := Params.Metabase;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get metamodel
MetaModel := mb.ItemByIdNamespace["METAMODEL_TRANSF_OUTPUT", MsKey].Edit() As IMsMetaModel;
// Get metamodel parameters
pParams := MetaModel.Params;
// Remove all parameters
pParams.Clear();
// Add metamodel parameter to set start of data downloading period
pPar := pParams.Add();
pPar.Id := "OUT_START";
pPar.Name := "Data downloading start";
pPar.DataType := DbDataType.ddtDate;
pPar.DefaultValue := DateTime.Parse("01.01.2018");
// Add metamodel parameter to set data downloading period end
pPar := pParams.Add();
pPar.Id := "OUT_END";
pPar.Name := "Data downloading end";
pPar.DataType := DbDataType.ddtDate;
pPar.DefaultValue := DateTime.Parse("01.01.2020");
// Save changes of the metamodel
(MetaModel As IMetabaseObject).Save();
// Get the model
pModel := mb.ItemByIdNamespace["MODEL_TRANSF_OUTPUT", MsKey].Edit() As IMsModel;
// Get model calculation period parameters
pPeriod := pModel.Transform.OutputPeriod As IMsDatePeriod;
pPeriod.ClearPeriod();
// Set model parameters determining start and end of data downloading period
pPeriod.StartParamID := "OUT_START";
pPeriod.EndParamID := "OUT_END";
// Save changes in the model
(pModel As IMetabaseObject).Save();
End Sub;
See also: