kuldeepsharma
22nd May 2007, 06:53
Dear All,
please see the following code. in this script I have debugged it. As sson as select statement is encountered it hangs. then I have changed my script to the IInd option it is working fine. I want to know where i was going wrong in the Ist script.
I want to use the First one because it uses index and it will be faster.
tfgld106 is a standard table and has index5 as tfgld106.dim2, tfgld106.leac,coo2 {which is combined field for document nos etc}
Ist Script.
extern domain tfgld.dimx dim2.f, dim2.t
function get.op.bal()
{
select tfgld106.*
from tfgld106
where tfgld106._index5 inrange {:dim2.f,:tfgld008.leac} and {:dim.t,:tfgld008.leac}
and tfgld106.trun > 0
and tfgld106.dcdt < :date.f
and tfgld106.oyer = :i.year
selectdo
if tfgld106.dbcr = tfgld.dbcr.debit then
run.amnt = run.amnt + tfgld106.amnt
else
run.amnt = run.amnt - tfgld106.amnt
endif
endselect
calculate.bal.amnt()
}
IInd Script
extern domain tfgld.dimx dim2.f, dim2.t
function get.op.bal()
{
select tfgld106.*
from tfgld106
where tfgld106._index3 inrange {:tfgld008.leac} and {:tfgld00.leac}
and tfgld106.dim2 >= :dim2.f and tfgld106.dim2 <= :dim2.t
and tfgld106.trun > 0
and tfgld106.dcdt < :date.f
and tfgld106.oyer = :i.year
selectdo
if tfgld106.dbcr = tfgld.dbcr.debit then
run.amnt = run.amnt + tfgld106.amnt
else
run.amnt = run.amnt - tfgld106.amnt
endif
endselect
calculate.bal.amnt()
}
Thanks and regards to all in advance
:confused:
please see the following code. in this script I have debugged it. As sson as select statement is encountered it hangs. then I have changed my script to the IInd option it is working fine. I want to know where i was going wrong in the Ist script.
I want to use the First one because it uses index and it will be faster.
tfgld106 is a standard table and has index5 as tfgld106.dim2, tfgld106.leac,coo2 {which is combined field for document nos etc}
Ist Script.
extern domain tfgld.dimx dim2.f, dim2.t
function get.op.bal()
{
select tfgld106.*
from tfgld106
where tfgld106._index5 inrange {:dim2.f,:tfgld008.leac} and {:dim.t,:tfgld008.leac}
and tfgld106.trun > 0
and tfgld106.dcdt < :date.f
and tfgld106.oyer = :i.year
selectdo
if tfgld106.dbcr = tfgld.dbcr.debit then
run.amnt = run.amnt + tfgld106.amnt
else
run.amnt = run.amnt - tfgld106.amnt
endif
endselect
calculate.bal.amnt()
}
IInd Script
extern domain tfgld.dimx dim2.f, dim2.t
function get.op.bal()
{
select tfgld106.*
from tfgld106
where tfgld106._index3 inrange {:tfgld008.leac} and {:tfgld00.leac}
and tfgld106.dim2 >= :dim2.f and tfgld106.dim2 <= :dim2.t
and tfgld106.trun > 0
and tfgld106.dcdt < :date.f
and tfgld106.oyer = :i.year
selectdo
if tfgld106.dbcr = tfgld.dbcr.debit then
run.amnt = run.amnt + tfgld106.amnt
else
run.amnt = run.amnt - tfgld106.amnt
endif
endselect
calculate.bal.amnt()
}
Thanks and regards to all in advance
:confused: