Baan provides the mechanism to define functions with variable number of arguments in two basic ways.
a) Max argument count is fixed.
The syntax for it is as follows.
function_name(long arg1, [long arg2], [long arg3])
This function defined as above can be called in 3 ways
1) function_name(val1)
2) function_name(val1, val2)
3) function_name(val1, val2, val3)
Usage:
function sample(long arg1, [long arg2], [long arg3])
{
long val2, val3
val2 = get.long.arg(2)
val3 = get.long.arg(3)
......
......
}
b) Argument count is not fixed.
The syntax for it is as follows.
function_name(long arg1, ... )
This function defined as above can be called in 3 ways
1) function_name(val1)
2) function_name(val1, val2)
.....
.....
.....
n) function_name(val1, val2, ......., valn)
Usage:
function sample(long arg1, ... )
{
long long_value
dounble double_value
string string_value
for i = 2 to get.argc()
on case get.arg.type(i)
case DB.LONG:
long_value = get.long.arg(i)
......
break
case DB.DOUBLE:
double_value = get.double.arg(i)
......
break
default:
string_value = get.string.arg(i)
......
break
endcase
endfor
}
:) Just do these and enjoy!!!!!!!
a) Max argument count is fixed.
The syntax for it is as follows.
function_name(long arg1, [long arg2], [long arg3])
This function defined as above can be called in 3 ways
1) function_name(val1)
2) function_name(val1, val2)
3) function_name(val1, val2, val3)
Usage:
function sample(long arg1, [long arg2], [long arg3])
{
long val2, val3
val2 = get.long.arg(2)
val3 = get.long.arg(3)
......
......
}
b) Argument count is not fixed.
The syntax for it is as follows.
function_name(long arg1, ... )
This function defined as above can be called in 3 ways
1) function_name(val1)
2) function_name(val1, val2)
.....
.....
.....
n) function_name(val1, val2, ......., valn)
Usage:
function sample(long arg1, ... )
{
long long_value
dounble double_value
string string_value
for i = 2 to get.argc()
on case get.arg.type(i)
case DB.LONG:
long_value = get.long.arg(i)
......
break
case DB.DOUBLE:
double_value = get.double.arg(i)
......
break
default:
string_value = get.string.arg(i)
......
break
endcase
endfor
}
:) Just do these and enjoy!!!!!!!
No comments:
Post a Comment