avpatil
16th January 2003, 21:56
Hi,
I am trying to use alias see the code below

{
Select tccom010.*, tdsls045.*
from tccom010, tdsls045
where tdsls045._index1 inrange {:orno.f}
and {:orno.t}
and tdsls045.cuno refers to tccom010
order by tdsls045._index1
selectdo
if not isspace(tccom010.pctf) then
if not doubtful parent (tccom010.pctf) then
do something
else
do something else
endif
endselect
}

function domain tcbool doubtful.parent(
domain tccuno f.cuno)
{
select a.cnpa,a.cuno
from tccom010 a
where a._index1 = {:f.cuno}
and a.cnpa = tccnpa.doubtful
order by a._index1
selectdo
return(true)
endselect
return(false)
}

After returning from second function the customer number in first function changes. It seems it is loosing the pointer. This is type 4 session. Any idea? I thought alias will keep my pointer in tact.

Thanks

Arvind Patil

lbencic
17th January 2003, 00:41
Arvind
Not sure why your structure doesn't work, it seems ok but I don't usually code em that way.

What you can try instead is:


function domain tcbool doubtful.parent(
domain tccuno f.cuno)
{
domain tccuno hold.cuno
domain tccnpa hold.cnpa

select tccom010.cnpa:hold.cnpa,
tccom010.cuno:hold.cuno
from tccom010
where tccom010._index1 = {:f.cuno}
and tccom001.cnpa = tccnpa.doubtful
order by tccom010._index1
selectdo
return(true)
endselect
return(false)
}


Also..probably don't need the order by as it will get only 1 record max.

NPRao
17th January 2003, 01:06
I am not sure if BaaN allows to use aliases for the tables names like that. Your code seems more like Oracle Syntax for aliases for tables.

you can add the clause - "as set with 1 rows" - if only one record is expected to make your SQL efficient.

avpatil
21st January 2003, 04:55
Hi,
Thanks for your reply. THe Alias syntax is correct. And my second function will return only one record. I had to use db.row.length function that will keep the pointer in tact. But then I thought what is the use of ALiases then?

Arvind