lcfcfan,
I saw your message about understanding functions so here is a quick explanation:
Assuming you know how to use Subroutines, a Function is basically a subroutine that can accept arguments(parameters) and RETURN some value back to the calling code. In DBP this a little light-weight compared to object orient languages like C++/VB.NET/or even VB6. C++ by the way has no concept of subroutines, its all done in functions and you either return a value or void. I am a VB programmer and use functions quite a bit as well as subs but in DBP i tend to use all subs and very few funcs as the whole structure DB tends to make variables global which kind of renders functions useless depending on what you are doing. It's good to write Functions and Subs as reusable code, meaning as generic as possible so you can plug in the right parameters and get your results. A super simple example of a function would be a function that takes two numbers and adds them, then returns the result to the calling code. The function can be called from anywhere in your code when you needed to add two numbers like
FUNCTION SampleFunction(Value1 as integer,Value2 as Integer)
ReturnValue = Value1 + Value2
ENDFUNCTION ReturnValue
DB is weird in that it needs some other variable in the mix to return where as in VB or C++ you would use the function name as the variable holder and type like:
FUNCTION SampleFunction(Value1 as integer,Value2 as Integer)as Integer
SampleFunction = Value1 + Value2
END FUNCTION
but in either case the call in db is similar in that you'd say
MyVariable=SampleFunction(first number, second number)
Then your variable MyVariable will have the returned result of the function. Note that the arguments to the function can be either variables (of integer in this case) or integer literals like 1,2,100 etc etc.
Hope this helps
Rustler
How do ya do there son