IMobilePublishRubricator.SetFactors

Fore Syntax

SetFactors(Value: Array);

Fore.NET Syntax

SetFactors(Value: System.Array);

Parameters

Value. The array of series keys.

Description

The SetFactors method selects the specified selection of elements of the time series database.

Comments

To get the current selection of elements, use the IMobilePublishRubricator.LoadFactors method.

Fore Example

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 mobile application 
    Mobile := mb.ItemById("MA_PUB").Bind As IMobileApplication;
    // Create a mobile application publisher 
    Publicator := Mobile.CreatePublicator;
    // Get 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 series keys with annual frequency changed in the latest revision
            RubInst := PubObj.Object.Open(NullAs 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 selection for these series
            RubPubObj.SetFactors(Atts);
            // Specify path for publishing
            PubObj.ExportPath := "C:\" + PubObj.Object.Id + ".zip";
            // Publish working time series database
            res := PubObj.Publish;
            // Display 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: time series databases in the mobile application will be published with the specified selection and publishing results are displayed in the console window.

Fore.NET Example

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 mobile application 
    Mobile := mb.ItemById["MA_PUB"].Bind() As IMobileApplication;
    // Create a mobile application publisher 
    Publicator := Mobile.CreatePublicator();
    // Get 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 series keys with annual frequency changed in the latest revision
            RubInst := PubObj.Object.Open(NullAs 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 selection for these series
            RubPubObj.SetFactors(Atts);
            // Specify path for publishing
            PubObj.ExportPath := "C:\" + PubObj.Object.Id + ".zip";
            // Publish working time series database
            res := PubObj.Publish(Null);
            // Display 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: time series databases in the mobile application will be published with the specified selection and publishing results are displayed in the console window.

See also:

IMobilePublishRubricator