avin_ln
14th August 2014, 12:29
hello everyone,
I want a pass a argument which is optional in function. Can it be done in LN?
vamsi_gujjula
14th August 2014, 12:47
function tfgld.date conv.utc.to.date.num(
domain tcpono i.x,
[ref domain tcpono i.y])
{
if get.argc() = 2 then
message( " two args %d - %s " , i.x , get.long.arg (2) )
else
message( " 1 args %d " , i.x )
endif
}
avin_ln
14th August 2014, 12:51
Thank you, Vamsi Gujjula
Got the solution
sachinbaan
20th August 2014, 13:28
Hi Vamsi Gujjula,
I was looking for this solution, thanx for the solution,
Now one problem is there, when I am passing values to optional argument, I didn't get that value to the functions. so what to do?
bhushanchanda
20th August 2014, 14:33
Hi,
Is the variable you are passing declared extern?
sachinbaan
21st August 2014, 07:31
Hi,
I m passing table fields values as argument.
bhushanchanda
21st August 2014, 08:31
Hi,
Try declaring your table as extern. Also if that doesnt work try assogning table field value to a variable.
NPRao
3rd September 2014, 00:46
Now one problem is there, when I am passing values to optional argument, I didn't get that value to the functions. so what to do?
Refer to the following functions to get the values from the optional arguments.
get.double.arg(), get.long.arg(), get.string.arg() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_varying_arguments_get_many_arg)
Functions with variable number of arguments: sample program (http://www.baanboard.com/programmers_manual_baanerp_help_functions_varying_arguments_example)
Sample code:
function extern void show.file( const string fname(),
[string devc(14)])
{
...
if get.argc() = 2 then
devc = get.string.arg(2)
mode = 0
if tt.device(devc, dev.desc, devtype) then
splid = spool.open("", devc, 0)
else
splid = spool.open("", "", 1)
endif
else
splid = spool.open("", devc, 1)
endif
...
}
vamsi_gujjula
3rd September 2014, 11:46
hmmm NPRao... took on my post..... :p ..just kidding..
avin_ln
3rd September 2014, 12:05
Thank You NPRao
sachinbaan
3rd September 2014, 14:04
Thank You NPRao.... :)