DataType: DbDataType;
The DataType property returns data type of parameter.
To get parameter type, use the ITsModelParamValue.ParamType property.
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.
See also: