WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

UDF - UDS Library
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

UDF UDS Parameter Limit

 Keywords: User Defined Function Subroutine Input Parameter Limit Limitation 16 UDF UDS Syntax Error

Question:

I am getting a syntax error if I use more then 16 input paramteters to a user defined function, is this the limit? Is there a work around?

Answer:

Yes that is the limit. Have you considered passing in a single array that contains all of your parameters?

Basically, instead of doing:

; Doesn't work - 17 parameters
#DefineFunction udfFoo(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q)
#EndFunction
You do:
#DefineFunction udfFoo(arrA)
#EndFunction
And then call it something like this:
arrA = ArrDimension(17)
For I = 0 To 16
   arrA[I] = Something...
Next
udfFoo(arrA)
Note that arrays are "magic" in two ways, as function parameters. First, as above, they can be used to send arbitrary length data. Second, they are "call by reference" - changes made in the function are passed back to the caller's array. This can be a way to get around the variable scoping rules that WinBatch imposes on functions, as well as providing a way to return multiple values (i.e., besides the main function return value).
Article ID:   W18337
Filename:   UDF UDS Parameter Limit.txt
File Created: 2011:09:29:08:21:34
Last Updated: 2011:09:29:08:21:34