IPrxDataSource.DataSource

Fore Syntax

DataSource: IMatrixDataSource;

Fore.NET Syntax

DataSource: Prognoz.Platform.Interop.Matrix.IMatrixDataSource;

Description

The DataSource property determines a multidimensional matrix of the data source.

Fore Example

Executing the example requires a regular report with the REGULAR_REPORT identifier that contains data sources. Add a table based on the first data source to the report.

Add links to the Dimensions, Matrix, Metabase, Report system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    DtSources: IPrxDataSources;
    DtSource: IPrxDataSource;
    DimSS: IDimSelectionSet;
    Matr: IMatrix;
    MatrDS: IMatrixDataSource;
    Coord: IMatrixCoord;
    i: Integer;
Begin
    //Open report for edit
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("REGULAR_REPORT").Edit;
    Report := MObj As IPrxReport;
    //Get the first report data source
    DtSources := Report.DataSources;
    DtSource := DtSources.Item(0);
    //Determine multidimensional matrix of the source
    MatrDS := DtSource.DataSource;
    //Replace matrix element value, if data source is editable
    If MatrDS.ReadOnly = False Then
        DimSS := MatrDS.CreateDimSelectionSet;
        Matr := MatrDS.Execute(DimSS);
        Coord := Matr.CreateCoord;
        For i := 0 To Matr.DimensionCount - 1 Do
            Coord.Item(i) := 0;
        End For;
        Matr.Item(Coord) := 10;
        //Save data matrix in source
        MatrDS.SaveData(Matr);
        //Save regular report
        MObj.Save;
    End If;
End Sub UserProc;

After executing the example the regular report contains the value set in the first data source table.

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.Report;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Dimensions;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    DtSources: IPrxDataSources;
    DtSource: IPrxDataSource;
    DimSS: IDimSelectionSet;
    Matr: IMatrix;
    MatrDS: IMatrixDataSource;
    Coord: IMatrixCoord;
    i: Integer;
Begin
    //Open report for edit
    MB := Params.Metabase;
    MObj := MB.ItemById["REGULAR_REPORT"].Edit();
    Report := MObj As IPrxReport;
    //Get the first report data source
    DtSources := Report.DataSources;
    DtSource := DtSources.Item[0];
    //Determine multidimensional matrix of the source
    MatrDS := DtSource.DataSource;
    //Replace matrix element value, if data source is editable
    If MatrDS.@ReadOnly = False Then
        DimSS := MatrDS.CreateDimSelectionSet();
        Matr := MatrDS.Execute(DimSS);
        Coord := Matr.CreateCoord();
        For i := 0 To Matr.DimensionCount - 1 Do
            Coord.Item[i] := 0;
        End For;
        Matr.Item[Coord] := 10;
        //Save data matrix in source
        MatrDS.SaveData(Matr);
        //Save regular report
        MObj.Save();
    End If;  
End Sub;

See also:

IPrxDataSource