Item(Index: Integer): IForeSubParam;
Item[Index: Integer]: Prognoz.Platform.Interop.KeFore.IForeSubParam;
Index. Parameter index in the collection.
The Item method returns a parameter by index.
Executing the example requires a unit with the MODULE identifier. In the unit global namespace the function is implemented:
Function Calculate(a, b: Integer; c: Double): Double;
Var
Result: Double;
Begin
//...
//Calculate taking into account parameter values
//...
Return Result
End Function Calculate;
Add a link to the Fore, Metabase system assembly.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FSub: IForeSub;
Params: IForeSubParams;
Param: IForeSubParam;
i, c: Integer;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
//Load assembly
Runtime.LoadAssembly("MODULE");
Assm := Runtime.BindToAssembly("MODULE");
//Get function
FSub := Assm.BindToSub("Calculate");
//Get information about function parameters
Params := FSub.Params;
c := Params.Count;
For i := 0 To c - 1 Do
Param := Params.Item(i);
Debug.WriteLine("Parameter: " + Param.Name + "; Value type: " + Param.TypeName);
End For;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FSub: IForeSub;
SubParams: IForeSubParams;
Param: IForeSubParam;
i, c: Integer;
Begin
ForeService := Params.Metabase As IForeServices;
Runtime := ForeService.GetRuntime();
//Load assembly
Runtime.LoadAssembly("MODULE");
Assm := Runtime.BindToAssembly("MODULE");
//Get function
FSub := Assm.BindToSub("Calculate");
//Get information about function parameters
SubParams := FSub.Params;
c := SubParams.Count;
For i := 0 To c - 1 Do
Param := SubParams.Item(i);
System.Diagnostics.Debug.WriteLine("Parameter: " + Param.Name + "; Value type: " + Param.TypeName);
End For;
End Sub;
On executing the example, the specified unit is loaded to execution environment. The Calculate function will be obtained and the information about its parameters will be displayed to the development environment console.
See also: