IMobileApplicationPublicator.GetLastPublishResult

Fore Syntax

GetLastPublishResult: IMobileApplicationPublicatorErrorObject;

Fore.NET Syntax

GetLastPublishResult: Prognoz.Platform.Interop.Mobile.IMobileApplicationPublicatorErrorObject;

Description

The GetLastPublishResult method returns the object containing information about result of mobile application publication.

Comments

To determine whether publication of mobile application stops on any error, use IMobileApplicationPublicator.GetLastPublishResult.

Fore Example

Executing the example requires that the repository contains a mobile application container with the MA_PUB_ADHOC identifier. The mobile application container contains a dashboard. The dashboard has the 19869 key.

Add links to the Metabase, Mobile system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Mobile: IMobileApplication;
    Publicator: IMobileApplicationPublicator;
    PubObjs: IMobileApplicationPublishObjects;
    PubObj: IMobileApplicationPublishObject;
    PObj: IMobilePublishObject;
    Res: MobilePublishObjectResult;
    LastPubResult: IMobileApplicationPublicatorErrorObject;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get mobile application
    Mobile := MB.ItemById("MA_PUB_ADHOC").Bind As IMobileApplication;
    // Create a mobile application publisher
    Publicator := Mobile.CreatePublicator;
    // Cancel publication on the first error
    Publicator.BreakOnError := True;
    // Get collection of published objects
    PubObjs := Publicator.Items;
    // Get published dashboard by key
    PubObj := PubObjs.ItemByKey(19869);
    PObj := PubObj.PublishObject;
    // Set publication path
    PObj.ExportPath := "C:\" + PObj.Object.Id + ".zip";
    // Publish dashboard
    Res := PObj.Publish;
    // Display result in the console window
    If (Res As Integer) = 0 Then Debug.WriteLine("Publication was successful!");
        Debug.WriteLine("Publication path: " + PObj.ExportPath);
    Else
        Debug.WriteLine("Error occurred on publishing!");
    End If;
    If PObj.PublishWarnings <> 0 Then
        Debug.WriteLine("Warning:");
        Debug.WriteLine(PObj.GetPublishWarningsText(PObj.PublishWarnings)[0]);
    End If;
    // Get object containing the last result of publication
    LastPubResult := Publicator.GetLastPublishResult;
    // Display the last result of publication in the console window
    Debug.WriteLine("Name of problem object - " + LastPubResult.ObjectName);
    Debug.WriteLine("Code of mobile application publication result - " + LastPubResult.Result.ToString);
End Sub UserProc;

After executing the example the dashboard is published to the specified format by the specified path. The console window displays:

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Mobile;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Mobile: IMobileApplication;
    Publicator: IMobileApplicationPublicator;
    PubObjs: IMobileApplicationPublishObjects;
    PubObj: IMobileApplicationPublishObject;
    PObj: IMobilePublishObject;
    Res: MobilePublishObjectResult;
    LastPubResult: IMobileApplicationPublicatorErrorObject;
Begin
    // Get repository
    MB := Params.Metabase;
    // Get mobile application
    Mobile := MB.ItemById["MA_PUB_ADHOC"].Bind() As IMobileApplication;
    // Create a mobile application publisher
    Publicator := Mobile.CreatePublicator();
    // Cancel publication on the first error
    Publicator.BreakOnError := True;
    // Get collection of published objects
    PubObjs := Publicator.Items;
    // Get published dashboard by key
    PubObj := PubObjs.ItemByKey[19869];
    PObj := PubObj.PublishObject;
    // Set publication path
    PObj.ExportPath := "C:\" + PObj.Object.Id + ".zip";
    // Publish dashboard
    Res := PObj.Publish(Null);
    // Display result in the console window
    If (Res As Integer) = 0 Then System.Diagnostics.Debug.WriteLine("Publication was successful!");
        System.Diagnostics.Debug.WriteLine("Publication path: " + PObj.ExportPath);
    Else
        System.Diagnostics.Debug.WriteLine("Error occurred on publishing!");
    End If;
    If PObj.PublishWarnings <> 0 Then
        System.Diagnostics.Debug.WriteLine("Warning:");
        System.Diagnostics.Debug.WriteLine(PObj.GetPublishWarningsText(PObj.PublishWarnings).GetValue(0).GetValue(0));
    End If;
    // Get object containing the last result of publication
    LastPubResult := Publicator.GetLastPublishResult();
    // Display the last result of publication in the console window
    System.Diagnostics.Debug.WriteLine("Name of problem object - " + LastPubResult.ObjectName);
    System.Diagnostics.Debug.WriteLine("Code of the mobile application publication result - " + LastPubResult.Result.ToString());
End Sub;

See also:

IMobileApplicationPublicator