SetFactors(Value: Array);
SetFactors(Value: System.Array);
Value. The array of series keys.
The SetFactors method selects the specified selection of elements of the time series database.
To get the current selection of elements, use the IMobilePublishRubricator.LoadFactors method.
Executing the example requires that the repository contains a mobile application with the MA_PUB identifier. Add links to the Metabase, Mobile, Orm, Cubes, Dimensions, and Rds system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Mobile: IMobileApplication;
Publicator: IMobileApplicationPublicator;
MaPubObs: IMobileApplicationPublishObjects;
i: Integer;
MaPubObj: IMobileApplicationPublishObject;
PubObj: IMobilePublishObject;
RubInst: IRubricatorInstance;
FactsL: IRubricatorFactsLookup;
MetaDLookup: IMetaDictionaryLookup;
Cond: IOrmCondition;
RubPubObj: IMobilePublishRubricator;
Atts: Array Of Integer;
res: MobilePublishObjectResult;
Begin
mb := MetabaseClass.Active;
// Get the mobile application
Mobile := mb.ItemById("MA_PUB").Bind As IMobileApplication;
// Create a mobile application publicator
Publicator := Mobile.CreatePublicator;
// Get the mobile application objects
MaPubObs := Publicator.Items;
For i := 0 To MaPubObs.Count - 1 Do
MaPubObj := MaPubObs.Item(i);
// Choose among objects of the time series database
If MaPubObj.Type = MobilePublishObjectType.Rubricator Then
PubObj := MaPubObj.PublishObject;
// Get the series keys with the annual frequency, changed in the latest revision
RubInst := PubObj.Object.Open(Null) As IRubricatorInstance;
FactsL := RubInst.CreateFactsLookup;
MetaDLookup := FactsL.Lookup;
Cond := MetaDLookup.Where.Add;
Cond.AttributeName := "DL";
Cond.Value := DimCalendarLevel.Year As Integer;
Atts := MetaDLookup.LookupKeys("REV");
Cond := MetaDLookup.Where.Add;
Cond.AttributeName := "REV";
Atts := MetaDLookup.LookupKeys("KEY");
RubPubObj := PubObj As IMobilePublishRubricator;
// Set the selection for these series
RubPubObj.SetFactors(Atts);
// Specify the path for publishing
PubObj.ExportPath := "C:\" + PubObj.Object.Id + ".zip";
// Publish the working time series database
res := PubObj.Publish;
// Display the result in the console window
If (res As integer) = 0 Then
Debug.WriteLine("Publishing was successful").
Debug.WriteLine(" Publishing path: " + PubObj.ExportPath);
Else
Debug.WriteLine("Error occurred on publishing").
End If;
End If;
End For;
End Sub UserProc;
Example execution result: the time series databases in the mobile application are to be published with the specified selection and the publishing results are displayed in the console window.
Executing the example requires that the repository contains a mobile application with the MA_PUB identifier.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Mobile;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Orm;
Imports Prognoz.Platform.Interop.Dimensions;
…
[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Mobile: IMobileApplication;
Publicator: IMobileApplicationPublicator;
MaPubObs: IMobileApplicationPublishObjects;
i: Integer;
MaPubObj: IMobileApplicationPublishObject;
PubObj: IMobilePublishObject;
RubInst: IRubricatorInstance;
FactsL: IRubricatorFactsLookup;
MetaDLookup: IMetaDictionaryLookup;
Cond: IOrmCondition;
RubPubObj: IMobilePublishRubricator;
Atts: Array Of Integer;
res: MobilePublishObjectResult;
Begin
mb := Params.Metabase;
// Get the mobile application
Mobile := mb.ItemById["MA_PUB"].Bind() As IMobileApplication;
// Create a mobile application publicator
Publicator := Mobile.CreatePublicator();
// Get the mobile application objects
MaPubObs := Publicator.Items;
For i := 0 To MaPubObs.Count - 1 Do
MaPubObj := MaPubObs.Item[i];
// Choose among objects of the time series database
If MaPubObj.Type = MobilePublishObjectType.mpotRubricator Then
PubObj := MaPubObj.PublishObject;
// Get the series keys with the annual frequency, changed in the latest revision
RubInst := PubObj.Object.Open(Null) As IRubricatorInstance;
FactsL := RubInst.CreateFactsLookup();
MetaDLookup := FactsL.Lookup;
Cond := MetaDLookup.Where.Add();
Cond.AttributeName := "DL";
Cond.Value := DimCalendarLevel.dclYear As Integer;
Atts := MetaDLookup.LookupKeys("REV") As array Of integer;
Cond := MetaDLookup.Where.Add();
Cond.AttributeName := "REV";
Atts := MetaDLookup.LookupKeys("KEY") As array Of integer;
RubPubObj := PubObj As IMobilePublishRubricator;
// Set the selection for these series
RubPubObj.SetFactors(Atts);
// Specify the path for publishing
PubObj.ExportPath := "C:\" + PubObj.Object.Id + ".zip";
// Publish the working time series database
res := PubObj.Publish(Null);
// Display the result in the console window
If (res As integer) = 0 Then
System.Diagnostics.Debug.WriteLine("Publishing was successful").
System.Diagnostics.Debug.WriteLine(" Publishing path: " + PubObj.ExportPath).
Else
System.Diagnostics.Debug.WriteLine("Error occurred on publishing").
End If;
End If;
End For;
End Sub;
Example execution result: the time series databases in the mobile application are to be published with the specified selection and the publishing results are displayed in the console window.
See also: