billydeng
4th November 2008, 05:03
Hi Guys
I want to return a field value from a select query inside a function then I can use this function as a single value but I am not sure wether this works or not
is this going to work? if it is not,is there any other way to do that. Thanks
Function read.delivery.date()
{
if tisfc920.ccom = tcyesno.yes then
select tisfc001.*
from tdsls001
where tdsls001._index1 = tisfc920._index1
selectdo
return (tisfc001.dldt)
endselect

endif

commit.transaction()
}

MilindV
4th November 2008, 05:50
Hi billydeng

Yes you can return field within SQL query
(selectdo/selectempty/selecteos sections, this works in LN,
I hope the same should work in IV also),

(may be you have forgot to specify the return type of function).

And what if there are no matching records in table tdsls001?

I hope, this answers your questions.

Regards,
MilindV

zardoz
4th November 2008, 09:49
commit.transaction() instruction seems useless (or even dangerous) here.
function declaration: you have to specify the type of return value; in this case, the last instruction of function must be return(...)


Try this:

function domain tcdate read.delivery.date()
{
if tisfc920.ccom = tcyesno.yes then
select tisfc001.*
from tdsls001
where tdsls001._index1 = tisfc920._index1
selectdo
return (tisfc001.dldt)
endselect
endif
return(0)
}