Search Results for

    Show / Hide Table of Contents

    Cube

    Cube Component is the Foundation of all FastCube. It stores the data in a cube and performs as the data provider and data schema for other components.

    The data in the cube can be loaded from the database from the source, or from a saved cube.

    Below you will find basic properties and methods of this component.

    Basic properties

    Property Description
    public bool Active Cube activity (data workload) - true or false. After the Cube opening the Active property is true. Only in this case visual components display data.
    public string Caption Cube caption. It’s visible in CubeGrid.
    public bool CompressCubeFile Whether to use compression when saving the cube data for later use or not.
    public string Description Description.
    public bool SkipFieldsWithErrors Specifies whether to ignore data source fields with errors (an unsupported type, etc.) or output Exception
    public SourceType SourceType The data source type specifies where to take data to populate the cube. Can be one of the following values: Empty, DataSource, File, Stream, Manual.

    Main methods

    Method Description
    public void ClearGroups() Clear grouping. While all groups applied will be cleared.
    public void Close() Close cube. The data cube and its structure will be cleared.
    public int GetFieldsCount() Get the number of fields in the cube.
    public int GetSourceRecordsCount() Get the number of source data records in the cube.
    public Utils.Variant GetSourceValue(int recordIndex, int fieldIndex) Get the value of data source field in specified record. Parameters – the record index and the index of the field.
    public Utils.Variant GetSourceValue(int recordIndex, CubeField cubeField) Get the value of data source field in specified record. Parameters – the record field index and the cube index.
    public string GetSourceValueAsString(int recordIndex, int fieldIndex) Get the value of a field in a data source to the specified record in the form of a string. Parameters - the index of the record and the index of the field.
    GetSourceValueAsString(int recordIndex, CubeField cubeField) Get the value of a field in a data source to the specified record in the form of a string. Parameters – the record index and the cube field.
    public int GetSourceValueId(int recordIndex, int fieldIndex) Get the unique value of a field in a data source to the specified record. Parameters - the index of the record and the index of the field.
    public int GetSourceValueId(int recordIndex, CubeField cubeField) Get the unique value of a field in a data source to the specified record.
    public int GetSourceValueIdAndVariant(int recordIndex, CubeField cubeField, ref Utils.Variant value) Receive a unique identifier of data source field value and the value itself in specified record. Parameters – the record field index and the value of the cube.
    public int GetSourceValueIdAndVariant(int recordIndex, int fieldIndex, ref Utils.Variant value) Receive a unique identifier of data source field value and the value itself in said recording. Parameters – the record Index, the index field and the value.
    void Load(Stream stream) Loads stored cube data from the stream. Cube is cleaned before loading.
    void Load(string fileName) Loads saved cube data from the specified file. Cube is cleaned before loading.
    public void Open() Open Cube. Loads cube from a data source specified in the settings.
    public void Save(Stream s, bool compress = true, object filter = null) Writes the cube structure and data to the stream.
    public void Save(string fileName) Writes the cube structure and data to the specified file.

    Loading of the cube from saved file

    FastReport.Olap.Cube.Cube cube = new FastReport.Olap.Cube.Cube();
    cube.Load(@"С:\Program Files (x86)\FastReports\FastCube.Net Professional\Demos\Data\Cubes\2_0_sample_en1.mdc");
    

    Loading of the cube from data source

    cube.SourceType = SourceType.DataSource;
    cube.DataSource = DataSource1;
    cube.Open();
    
    Back to top © 1998-2024 Copyright Fast Reports Inc.