IPPSpeedometerScales.Count

Fore Syntax

Count: Integer;

Fore.NET Syntax

Count: integer;

Description

The Count property returns size of scale collection.

Fore Example

Executing this example requires that the repository contains a database with the ADHOC identifier. A dashboard must contain speedometer.

Ad links to the Adhoc, Express, Metabase, Speedometer system assemblies.

Sub UserProc;
Var
    Speedometer: IPPSpeedometer;
    MB: IMetabase;
    AdhocReport: IAdhocReport;
    EaxSpeedometer: IEaxSpeedometer;
    Enalyzer: IEaxAnalyzer;
    DsObjs: IAdhocDataSourceObjects;
    Scales: IPPSpeedometerScales;
    Scale: IPPSpeedometerScale;
Begin
    MB := MetabaseClass.Active;
    // Get dashboard 
    AdhocReport := MB.ItemById("ADHOC").Edit As IAdhocReport;
    // Get dashboard data sources
    DsObjs := AdhocReport.DataSourceObjects;
    // Get speedometer
    Enalyzer := DsObjs.Item(0).GetSourceObject As IEaxAnalyzer;
    EaxSpeedometer := Enalyzer.Speedometer;
    // Get speedometer parameters
    Speedometer := EaxSpeedometer.Speedometer;
    // Get collection of speedometer scales
    Scales := Speedometer.Scales;
    // Output collection size
    Debug.Writeline("Number of elements in collection: " + Scales.Count.ToString);
    // Output data scale name
    Debug.Writeline("Data scale name: " + Scales.DataScale.Name);
    // Get scale by its index
    Scale := Scales.Item(0);
    // Remove all elements from collection
    Scales.RemoveAll;
    // Restore saved scale
    Scales.Add(Scale);
    (Enalyzer As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the console window displays messages with the number of scales in collection and data scale names. All elements are removed from collection of scales, then the previously saved scale is restored to the collection.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.AdHoc;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Speedometer;

Public Shared Sub Main(Params: StartParams);
Var
    Speedometer: IPPSpeedometer;
    MB: IMetabase;
    AdhocReport: IAdhocReport;
    EaxSpeedometer: IEaxSpeedometer;
    Enalyzer: IEaxAnalyzer;
    DsObjs: IAdhocDataSourceObjects;
    Scales: IPPSpeedometerScales;
    Scale: PPSpeedometerScale;
Begin
    MB := Params.Metabase;
    // Get dashboard 
    AdhocReport := MB.ItemById["ADHOC"].Edit() As IAdhocReport;
    // Get dashboard data sources
    DsObjs := AdhocReport.DataSourceObjects;
    // Get speedometer
    Enalyzer := DsObjs.Item[0].GetSourceObject() As IEaxAnalyzer;
    EaxSpeedometer := Enalyzer.Speedometer;
    // Get speedometer parameters
    Speedometer := EaxSpeedometer.Speedometer;
    // Get collection of speedometer scales
    Scales := Speedometer.Scales;
    // Output collection size
    System.Diagnostics.Debug.Writeline("Number of elements in collection: " + Scales.Count.ToString());
    // Output data scale name
    System.Diagnostics.Debug.Writeline("Data scale name: " + Scales.DataScale.Name);
    // Get scale by its index
    Scale := Scales.Item[0];
    // Remove all elements from collection
    Scales.RemoveAll();
    // Restore saved scale
    Scales.Add(Scale);
    (Enalyzer As IMetabaseObject).Save();
End Sub;

See also:

IPPSpeedometerScales

Related work items

Requirement