Name: String;
The Name property determines a parameter name.
Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. The calculation algorithm should contain at least one parameter.
Add links to the Algo, Metabase, and Transform system assemblies. Add links to the assemblies required for working with calculation algorithms.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Algo: ICalcObject;
CalcAlgo: ICalcAlgorithm;
ParamValues: IAlgorithmParameterValues;
ValueList: IAlgorithmParamValueList;
Param: IAlgorithmParamValue;
ParamType: String;
Begin
MB := MetabaseClass.Active;
// Get calculation algorithm
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Get collection of calculation algorithm parameters
ParamValues := CalcAlgo.ParamValues;
ValueList := ParamValues.Values;
// Get the first parameter and display its settings in the console
Param := ValueList.Item(0);
Debug.WriteLine("Name: " + Param.Name + '(' + Param.Id + ')');
Debug.Indent;
Select Case Param.ParamType As Integer
Case 5: ParamType := "Dictionary element selection";
Case 7: ParamType := "Alternative hierarchy";
End Select;
Debug.WriteLine("Parameter type: " + ParamType);
Debug.WriteLine("Dictionary: " + Param.LinkedObject.Name);
If Param.ParamType = TsParamType.Selection Then
Debug.WriteLine("Number of elements selected by default: " + (Param.Value As IDimSelection).SelectedCount.ToString);
Elseif Param.ParamType = TsParamType.Hierarchy Then
Debug.WriteLine("Alternative hierarchy key: " + Param.Value);
End If;
Debug.Unindent;
End Sub UserProc;
After executing the example the console displays settings of the first parameter:
Name: Planning version
Identifier: PLANNING_VERSION
Parameter type: Dictionary elements selection
Dictionary: Planning versions
The number of elements selected by default: 1
See also: