ITsModelParamValue.DataType

Fore Syntax

DataType: DbDataType;

Fore.NET Syntax

DataType: Prognoz.Platform.Interop.Dal.DbDataType;

Description

The DataType property returns data type of parameter.

Comments

To get parameter type, use the ITsModelParamValue.ParamType property.

Fore Example

Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. The modeling container must include a modeling problem with the PROBLEM identifier calculating metamodel with parameters.

Add links to the Metabase, Ms, Dal system assemblies.

Sub ParamVals;
Var
    mb: IMetabase;
    Ms: IMetabaseObjectDescriptor;
    Problem: IMsProblem;
    CalcSett: IMsProblemCalculationSettings;
    Calc: IMsProblemCalculation;
    ParamsVals: ITsModelParamValues;
    ParVal: ITsModelParamValue;
    i: Integer;
Begin
    mb := MetabaseClass.Active;
    // Get modeling container
    Ms := mb.ItemById("MODEL_SPACE");
    // Get modeling problem
    Problem := mb.ItemByIdNamespace("PROBLEM", Ms.Key).Bind As IMsProblem;
    // Create parameters or problem calculation
    CalcSett := Problem.CreateCalculationSettings;
    CalcSett.FactIncluded := True;
    // Get parameter values
    ParamsVals := CalcSett.ParamValues As ITsModelParamValues;
    // Display information about parameters in the console window
    For i := 0 To ParamsVals.Count - 1 Do
        ParVal := ParamsVals.Item(i);
        Debug.WriteLine("Parameter " + i.ToString + ":");
        Debug.WriteLine("  parameter identifier: " + ParVal.Id);
        Debug.WriteLine("  parameter key: " + ParVal.Key.ToString);
        Debug.WriteLine("  parameter name: " + ParVal.Name);
        Debug.WriteLine("  default value: " + ParVal.DefaultValue);
        Debug.WriteLine("  parameter is hidden: " + ParVal.Hidden.ToString);
        Debug.WriteLine("  parameter data type (value of the DbDataType enumeration): " + ParVal.DataType.ToString);
        Debug.WriteLine("  parameter type (value of the TsParamType enumeration): " + ParVal.ParamType.ToString);
        If ParVal.LinkedObject <> Null Then
            Debug.WriteLine("  dictionary, to which parameter refers: " + ParVal.LinkedObject.Name);
        End If;
    End For;
    // Calculate
    Calc := Problem.Calculate(CalcSett);
    Calc.Run;
End Sub ParamVals;

After executing the example a modeling problem is calculated, the console window displays values of parameters of the metamodel calculated by the problem.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Transform;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Ms: IMetabaseObjectDescriptor;
    Problem: IMsProblem;
    CalcSett: IMsProblemCalculationSettings;
    Calc: IMsProblemCalculation;
    ParamsVals: ITsModelParamValues;
    ParVal: ITsModelParamValue;
    i: Integer;
Begin
    mb := Params.Metabase;
    // Get modeling container
    Ms := mb.ItemById["MODEL_SPACE"];
    // Get modeling problem
    Problem := mb.ItemByIdNamespace["PROBLEM", Ms.Key].Bind() As IMsProblem;
    // Create parameters or problem calculation
    CalcSett := Problem.CreateCalculationSettings();
    CalcSett.FactIncluded := True;
    // Get parameter values
    ParamsVals := CalcSett.ParamValues As ITsModelParamValues;
    // Display information about parameters in the console window
    For i := 0 To ParamsVals.Count - 1 Do
        ParVal := ParamsVals.Item[i];
        System.Diagnostics.Debug.WriteLine
            ("Parameter " + i.ToString() + ":");
        System.Diagnostics.Debug.WriteLine
            ("  parameter identifier: " + ParVal.Id);
        System.Diagnostics.Debug.WriteLine
            ("  parameter key: " + ParVal.Key.ToString());
        System.Diagnostics.Debug.WriteLine
            ("  parameter name: " + ParVal.Name);
        System.Diagnostics.Debug.WriteLine
            ("  default value: " + ParVal.DefaultValue);
        System.Diagnostics.Debug.WriteLine
("parameter is hidden:"+ParVal.Hidden.ToString());         System.Diagnostics.Debug.WriteLine
("parameter data type (value of the DbDataType enumeration):"+ParVal.DataType.ToString());         System.Diagnostics.Debug.WriteLine
("parameter type (value of the TsParamType enumeration):"+ParVal.ParamType.ToString());         If ParVal.LinkedObject <> Null Then
            System.Diagnostics.Debug.WriteLine
("dictionary, to which parameter refers:"+ParVal.LinkedObject.Name);         End If;
    End For;
    // Calculate
    Calc := Problem.Calculate(CalcSett);
    Calc.Run();
End Sub;

See also:

ITsModelParamValue