IImportRequestProviderParams.DuplicateCheck

Fore Syntax

DuplicateCheck: CubeLoadDuplicateCheckSet;

Fore.NET Syntax

DuplicateCheck: Prognoz.Platform.Interop.Cubes.CubeLoadDuplicateCheckSet;

Description

The DuplicateCheck property determines a mode of excluding duplicate values.

Comments

To select time series loading mode, use the IImportRequestProviderParams.LoadType property.

Fore Example

Executing the example requires a time series database with the TSDB_IMP identifier containing mandatory custom attributes with the CITY and INDICATOR identifiers. These attributes must be links to the dictionary. The child container of time series database must have several scenarios.

The file system must have the D:\res_export.txt file with data.

Contents of the res_export.txt file

Add links to the Cubes, Db, Dimensions, Dt, Metabase, Ms, Rds system assemblies.

<font color="#008080">Sub</font><font color="#000000">&nbsp;UserProc;<br /> </font><font color="#008080">Var</font><font color="#000000"><br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider:&nbsp;IDtTextProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Mb:&nbsp;IMetabase;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TSDBObj:&nbsp;IMetabaseObject;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TSDB:&nbsp;IRubricator;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Attr:&nbsp;IMetaAttributes;<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo:&nbsp;IMetabaseObjectCreateInfo;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ImportRequestDef:&nbsp;IImportRequestDefinition;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Params:&nbsp;IImportRequestProviderParams;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Obj:&nbsp;IMetabaseObject;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Bindings:&nbsp;ICubeMetaLoaderBindings;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding:&nbsp;ICubeMetaLoaderBinding;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DimM:&nbsp;IDimensionModel;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Instance:&nbsp;IImportRequestInstance;<br /> </font><font color="#008080">Begin</font><font color="#000000"><br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Create&nbsp;data&nbsp;source&nbsp;for&nbsp;import&nbsp;from&nbsp;text&nbsp;file<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;TextProvider&nbsp;:=&nbsp;</font><font color="#008080">New</font><font color="#000000">&nbsp;DtTextProvider.Create;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.File&nbsp;:=&nbsp;</font><font color="#800000">&quot;D:\res_export.txt&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.FormatType&nbsp;:=&nbsp;DtTextFormatType.Delimited;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.DelimitedColumnDelimiter&nbsp;:=&nbsp;</font><font color="#800000">&quot;;&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.DelimitedTextQualifier&nbsp;:=&nbsp;</font><font color="#800000">&quot;&quot;&quot;&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Encoding&nbsp;:=&nbsp;</font><font color="#800000">&quot;WIN&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.RangeHasHeader&nbsp;:=&nbsp;</font><font color="#008080">True</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Open;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Get&nbsp;time&nbsp;series&nbsp;database<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Mb&nbsp;:=&nbsp;MetabaseClass.Active;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TSDBObj&nbsp;:=&nbsp;Mb.ItemById(</font><font color="#800000">&quot;TSDB_IMP&quot;</font><font color="#000000">).Bind;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TSDB&nbsp;:=&nbsp;TSDBObj&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IRubricator;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Attr&nbsp;:=&nbsp;TSDB.Facts.Attributes;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Create&nbsp;import&nbsp;object<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;CrInfo&nbsp;:=&nbsp;Mb.CreateCreateInfo;<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo.ClassId&nbsp;:=&nbsp;MetabaseObjectClass.KE_CLASS_IMPORTREQUEST;<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo.Id&nbsp;:=&nbsp;Mb.GenerateId(</font><font color="#800000">&quot;OBJ_IMPORTREQUEST_P&quot;</font><font color="#000000">,&nbsp;TSDBObj.Key);<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo.Name&nbsp;:=&nbsp;</font><font color="#800000">&quot;Import&nbsp;object&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo.Parent&nbsp;:=&nbsp;TSDBObj;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Obj&nbsp;:=&nbsp;Mb.CreateObject(CrInfo).Edit;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Specify&nbsp;data&nbsp;source<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;ImportRequestDef&nbsp;:=&nbsp;Obj&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IImportRequestDefinition;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ImportRequestDef.SourceType&nbsp;:=&nbsp;ImportRequestSourceType.Provider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Specify&nbsp;data&nbsp;consumer<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;ImportRequestDef.DestinationRubricator&nbsp;:=&nbsp;TSDB;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;import&nbsp;parameters<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Params&nbsp;:=&nbsp;ImportRequestDef.ProviderParams;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Params.Provider&nbsp;:=&nbsp;TextProvider&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDatasetDataProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Params.NewRevisionName&nbsp;:=&nbsp;</font><font color="#800000">&quot;Time&nbsp;series&nbsp;import&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Params.ImportObjectKey&nbsp;:=&nbsp;Obj.Key;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Params.LoadType&nbsp;:=&nbsp;CubeMetaLoaderLoadType.CreateAndUpdate;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Params.LoadMode&nbsp;:=&nbsp;CubeLoadClearMode.DataAndMetadata;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Params.DuplicateCheck&nbsp;:=&nbsp;CubeLoadDuplicateCheckSet.ValueAttribute&nbsp;</font><font color="#008080">Or</font><font color="#000000">&nbsp;CubeLoadDuplicateCheckSet.Value;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Specify&nbsp;scenario,&nbsp;to&nbsp;which&nbsp;data&nbsp;is&nbsp;loaded<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Params.ScenarioKey&nbsp;:=&nbsp;(TSDB.ModelSpace&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IMsModelSpace).ScenarioTree.Item(</font><font color="#008000">0</font><font color="#000000">).Key;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;attribute&nbsp;binding<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Bindings&nbsp;:=&nbsp;Params.Bindings;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;calendar&nbsp;binding<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.Calendar;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.ByColumns&nbsp;:=&nbsp;</font><font color="#008080">False</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.CalendarDateFormat&nbsp;:=&nbsp;</font><font color="#800000">&quot;$Year$&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.CalendarOptions.Levels&nbsp;:=&nbsp;DimCalendarLevelSet.Year;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.Name;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Field&nbsp;:=&nbsp;</font><font color="#800000">&quot;Year&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;binding&nbsp;of the&nbsp;Units attribute&nbsp;(UNIT)<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.Unit;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.ConstValue;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldValue&nbsp;:=&nbsp;</font><font color="#008000">1</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Attribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;UNIT&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DimM&nbsp;:=&nbsp;Attr.FindById(</font><font color="#800000">&quot;UNIT&quot;</font><font color="#000000">).ValuesObject.Bind&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDimensionModel;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Dimension&nbsp;:=&nbsp;DimM;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Index&nbsp;:=&nbsp;DimM.Indexes.Item(</font><font color="#008000">0</font><font color="#000000">).Id;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.KeyAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;binding&nbsp;of the&nbsp;Cities attribute&nbsp;(CITY)<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.Attribute;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Attribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;CITY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.Name;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Field&nbsp;:=&nbsp;</font><font color="#800000">&quot;CITY_KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DimM&nbsp;:=&nbsp;Attr.FindById(</font><font color="#800000">&quot;CITY&quot;</font><font color="#000000">).ValuesObject.Bind&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDimensionModel;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Dimension&nbsp;:=&nbsp;DimM;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Index&nbsp;:=&nbsp;DimM.Indexes.Item(</font><font color="#008000">0</font><font color="#000000">).Id;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.KeyAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.NameAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;NAME&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;binding&nbsp;of the&nbsp;Indicatros attribute&nbsp;(INDICATOR)<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.Attribute;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Attribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;INDICATOR&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.Name;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Field&nbsp;:=&nbsp;</font><font color="#800000">&quot;INDICATOR_KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DimM&nbsp;:=&nbsp;Attr.FindById(</font><font color="#800000">&quot;INDICATOR&quot;</font><font color="#000000">).ValuesObject.Bind&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDimensionModel;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Dimension&nbsp;:=&nbsp;DimM;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Index&nbsp;:=&nbsp;DimM.Indexes.Item(</font><font color="#008000">0</font><font color="#000000">).Id;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.KeyAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.NameAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;NAME&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;binding&nbsp;for&nbsp;import of&nbsp;series&nbsp;observation&nbsp;values<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.Value;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.Name;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Field&nbsp;:=&nbsp;</font><font color="#800000">&quot;Value&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Save&nbsp;changes&nbsp;in&nbsp;import&nbsp;object<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Obj.Save;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Import&nbsp;data<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Instance&nbsp;:=&nbsp;(ImportRequestDef&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IMetabaseObject).Open(</font><font color="#008080">Null</font><font color="#000000">)&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IImportRequestInstance;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Instance.LoadData;<br /> </font><font color="#008080">End</font><font color="#000000">&nbsp;</font><font color="#008080">Sub</font><font color="#000000">&nbsp;UserProc;</font>

After executing the example the data from the D:\res_export.txt file will be imported to the time series database and duplicate data will be excluded.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Rds;

<font color="#008080">Public</font><font color="#000000">&nbsp;</font><font color="#008080">Shared</font><font color="#000000">&nbsp;</font><font color="#008080">Sub</font><font color="#000000">&nbsp;Main(Params:&nbsp;StartParams);<br /> </font><font color="#008080">Var</font><font color="#000000"><br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider:&nbsp;IDtTextProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Mb:&nbsp;IMetabase;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TSDBObj:&nbsp;IMetabaseObject;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TSDB:&nbsp;IRubricator;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Attr:&nbsp;IMetaAttributes;<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo:&nbsp;IMetabaseObjectCreateInfo;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ImportRequestDef:&nbsp;IImportRequestDefinition;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ParamsImp:&nbsp;IImportRequestProviderParams;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Obj:&nbsp;IMetabaseObject;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Bindings:&nbsp;ICubeMetaLoaderBindings;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding:&nbsp;ICubeMetaLoaderBinding;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DimM:&nbsp;IDimensionModel;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Instance:&nbsp;IImportRequestInstance;<br /> </font><font color="#008080">Begin</font><font color="#000000"><br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Create&nbsp;data&nbsp;source&nbsp;to&nbsp;import&nbsp;from&nbsp;text&nbsp;file<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;TextProvider&nbsp;:=&nbsp;</font><font color="#008080">New</font><font color="#000000">&nbsp;DtTextProvider.Create();<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.File&nbsp;:=&nbsp;</font><font color="#800000">&quot;D:\res_export.txt&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.FormatType&nbsp;:=&nbsp;DtTextFormatType.tftDelimited;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.DelimitedColumnDelimiter&nbsp;:=&nbsp;</font><font color="#800000">&quot;;&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.DelimitedTextQualifier&nbsp;:=&nbsp;</font><font color="#800000">&quot;&quot;&quot;&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Encoding&nbsp;:=&nbsp;</font><font color="#800000">&quot;WIN&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.RangeHasHeader&nbsp;:=&nbsp;</font><font color="#008080">True</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Open();<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Get&nbsp;time&nbsp;series&nbsp;database<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Mb&nbsp;:=&nbsp;Params.Metabase;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TSDBObj&nbsp;:=&nbsp;Mb.ItemById[</font><font color="#800000">&quot;TSDB_IMP&quot;</font><font color="#000000">].Bind();<br /> &nbsp;&nbsp;&nbsp;&nbsp;TSDB&nbsp;:=&nbsp;TSDBObj&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IRubricator;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Attr&nbsp;:=&nbsp;TSDB.Facts.Attributes;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Create&nbsp;import&nbsp;object<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;CrInfo&nbsp;:=&nbsp;Mb.CreateCreateInfo();<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo.ClassId&nbsp;:=&nbsp;MetabaseObjectClass.KE_CLASS_IMPORTREQUEST&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;integer;<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo.Id&nbsp;:=&nbsp;Mb.GenerateId(</font><font color="#800000">&quot;OBJ_IMPORTREQUEST_P&quot;</font><font color="#000000">,&nbsp;TSDBObj.Key);<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo.Name&nbsp;:=&nbsp;</font><font color="#800000">&quot;Import&nbsp;object&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;CrInfo.Parent&nbsp;:=&nbsp;TSDBObj;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Obj&nbsp;:=&nbsp;Mb.CreateObject(CrInfo).Edit();<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Determine&nbsp;data&nbsp;source<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;ImportRequestDef&nbsp;:=&nbsp;Obj&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IImportRequestDefinition;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ImportRequestDef.SourceType&nbsp;:=&nbsp;ImportRequestSourceType.irstProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Determine&nbsp;data&nbsp;consumer<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;ImportRequestDef.DestinationRubricator&nbsp;:=&nbsp;TSDB;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;import&nbsp;parameters<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;ParamsImp&nbsp;:=&nbsp;ImportRequestDef.ProviderParams;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ParamsImp.Provider&nbsp;:=&nbsp;TextProvider&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDatasetDataProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ParamsImp.NewRevisionName&nbsp;:=&nbsp;</font><font color="#800000">&quot;Import&nbsp;time&nbsp;series&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ParamsImp.ImportObjectKey&nbsp;:=&nbsp;Obj.Key;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ParamsImp.LoadType&nbsp;:=&nbsp;CubeMetaLoaderLoadType.cmlltCreateAndUpdate;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ParamsImp.LoadMode&nbsp;:=&nbsp;CubeLoadClearMode.clcmDataAndMetadata;<br /> &nbsp;&nbsp;&nbsp;&nbsp;ParamsImp.DuplicateCheck&nbsp;:=&nbsp;CubeLoadDuplicateCheckSet.cldcValueAttribute&nbsp;</font><font color="#008080">Or</font><font color="#000000">&nbsp;CubeLoadDuplicateCheckSet.cldcValue;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;scenario,&nbsp;to&nbsp;which&nbsp;data&nbsp;will be&nbsp;loaded<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;ParamsImp.ScenarioKey&nbsp;:=&nbsp;(TSDB.ModelSpace&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IMsModelSpace).ScenarioTree.Item[</font><font color="#008000">0</font><font color="#000000">].Key&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;integer;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;attribute&nbsp;binding<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Bindings&nbsp;:=&nbsp;ParamsImp.Bindings;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;calendar&nbsp;binding<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add();<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.cmlbtCalendar;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.ByColumns&nbsp;:=&nbsp;</font><font color="#008080">False</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.CalendarDateFormat&nbsp;:=&nbsp;</font><font color="#800000">&quot;$Year$&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.CalendarOptions.Levels&nbsp;:=&nbsp;DimCalendarLevelSet.dclsYear;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.cmlftName;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Field&nbsp;:=&nbsp;</font><font color="#800000">&quot;Year&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;binding of the&nbsp;Measurement&nbsp;Units attribute&nbsp;(UNIT)<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add();<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.cmlbtUnit;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.cmlftConstValue;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldValue&nbsp;:=&nbsp;</font><font color="#008000">1</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Attribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;UNIT&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DimM&nbsp;:=&nbsp;Attr.FindById(</font><font color="#800000">&quot;UNIT&quot;</font><font color="#000000">).ValuesObject.Bind()&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDimensionModel;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Dimension&nbsp;:=&nbsp;DimM;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Index&nbsp;:=&nbsp;DimM.Indexes.Item[</font><font color="#008000">0</font><font color="#000000">].Id;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.KeyAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;binding&nbsp;of the Cities attribute&nbsp;(CITY)<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add();<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.cmlbtAttribute;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Attribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;CITY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.cmlftName;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Field&nbsp;:=&nbsp;</font><font color="#800000">&quot;CITY_KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DimM&nbsp;:=&nbsp;Attr.FindById(</font><font color="#800000">&quot;CITY&quot;</font><font color="#000000">).ValuesObject.Bind()&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDimensionModel;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Dimension&nbsp;:=&nbsp;DimM;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Index&nbsp;:=&nbsp;DimM.Indexes.Item[</font><font color="#008000">0</font><font color="#000000">].Id;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.KeyAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.NameAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;NAME&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;binding&nbsp;of the&nbsp;Factors attribute&nbsp;(INDICATOR)<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add();<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.cmlbtAttribute;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Attribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;INDICATOR&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.cmlftName;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Field&nbsp;:=&nbsp;</font><font color="#800000">&quot;INDICATOR_KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DimM&nbsp;:=&nbsp;Attr.FindById(</font><font color="#800000">&quot;INDICATOR&quot;</font><font color="#000000">).ValuesObject.Bind()&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDimensionModel;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Dimension&nbsp;:=&nbsp;DimM;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Index&nbsp;:=&nbsp;DimM.Indexes.Item[</font><font color="#008000">0</font><font color="#000000">].Id;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.KeyAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;KEY&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.NameAttribute&nbsp;:=&nbsp;</font><font color="#800000">&quot;NAME&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Set&nbsp;binding&nbsp;to&nbsp;import&nbsp;series&nbsp;observations&nbsp;values<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Binding&nbsp;:=&nbsp;Bindings.Add();<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.BindingType&nbsp;:=&nbsp;CubeMetaLoaderBindingType.cmlbtValue;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.FieldType&nbsp;:=&nbsp;CubeMetaLoaderFieldType.cmlftName;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Binding.Field&nbsp;:=&nbsp;</font><font color="#800000">&quot;Value&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Save&nbsp;changes&nbsp;to&nbsp;import&nbsp;object<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Obj.Save();<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//&nbsp;Import&nbsp;data<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;Instance&nbsp;:=&nbsp;(ImportRequestDef&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IMetabaseObject).Open(</font><font color="#008080">Null</font><font color="#000000">)&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IImportRequestInstance;<br /> &nbsp;&nbsp;&nbsp;&nbsp;Instance.LoadData();<br /> </font><font color="#008080">End</font><font color="#000000">&nbsp;</font><font color="#008080">Sub</font><font color="#000000">;</font>

See also:

IImportRequestProviderParams