IMsProblem.CreateVariablesReport

Syntax

CreateVariablesReport: IMsProblemVariablesReport;

Description

The CreateVariablesReport method creates a report by variables for modeling problem.

Comments

This method creates a report that does not contain any variables. To add variables, use the IMsproblemVariablesReport.AddVariable and IMsproblemVariablesReport.AddVariableKind methods.

Example

Executing the example requires that the repository contains a modeling container with the OBJ_MS identifier. This container includes a modeling problem with the PROBLEM identifier. It is also necessary to add links to the Metabase, Ms, Cubes, Matrix, Express, Pivot system assemblies.

    Sub UserProc;
    Var
        Mb: IMetabase;
        MsKey: Integer;
        Problem: IMsProblem;
        VarReport: IMsProblemVariablesReport;
        DataSource: IMatrixDataSource;
        Ci: IMetabaseObjectCreateInfo;
        Eax: IEaxAnalyzer;
        VarList: IVariableStubList;
        Varable: IVariableStub;
        s: String;
        i: Integer;
    Begin
        Mb := MetabaseClass.Active;
        MsKey := Mb.ItemById("OBJ_MS").Key;
        Problem := Mb.ItemByIdNamespace("PROBLEM", MsKey).Bind As IMsProblem;
        VarReport := Problem.CreateVariablesReport;
        VarReport.AddVariableKind(MsVariableKind.Output);
        VarList := Problem.VariableStubs(MsVariableKind.Input);
        Varable := VarList.Item(0);
        VarReport.AddVariable(Varable);
        DataSource := VarReport.CreateDataSource;
        Ci := Mb.CreateCreateInfo;
        Ci.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
        Ci.Parent := VarReport.ModelSpace As IMetabaseObjectDescriptor;
        Ci.Name := Report by output variables;
        Eax := Mb.CreateObject(Ci).Edit As IEaxAnalyzer;
        Eax.CreateMultiOlap(DataSource);
        VarReport.SetupSelection(Eax.Pivot.Selection);
        (Eax As IMetabaseObject).Save;
        s := (VarReport.Problem As IMetabaseObject).Name;
        Debug.WriteLine("Report by variables for problem '" + s + "'");
        Debug.WriteLine(Variables included into report:);
        VarList := VarReport.Variables;
        For i := 0 To VarList.Count - 1 Do
            Varable := VarList.Item(i);
            Debug.WriteLine("    " + Varable.Name);
        End For;
    End Sub UserProc;

After executing the example the report by variables for the PROBLEM problem is created in the OBJ_MS modeling container. The report contains the data of first input and all output variables. The variables names included into the report are displayed in the console window.

See also:

IMsProblem