I am trying to write a few very dynamic procedures and functions and wonder about transferring parameters to a procedure as an Array.
This is actually easy enough done.... just that I would like to pass something like
VAR
a,b,c : INTEGER;
Name, Text1,Text2 : STRING;
todaysDate : TDate;
PROCEDURE HandleValues(Const Values:ARRAY OF ???)
BEGIN
// Code to handle fetching the values.
END;
BEGIN
HandleValues([a,b,c,Name,Text1,TodaysDate]);
HandleValues([Name,Text1,Text2,a,c]);
END.
The whole point is that I do not know in which order the parameters occur in the array.
I do not know what type comes where.
If it only was a few possibilities, I would use OVERLOAD, but since my HandleValues procedure some times only get one parameter and other times maybe 30-50 parameters, Overload simply can not be used because the possible variations would be similar to those in lotto.
In my procedure HandleValues I need to be able to distinguish which type the parameter is as well. This so that it can be dealt with accordingly.
Any ideas of how to solve this?
Many thanks in advance.