evertsen
17th September 2002, 01:32
I've written some code that is supposed to move records from a table (tivkm001) in one company (112) to the same table in another company (114). However, what it does is place the records back in the same company (112) it just deleted them from.
Any ideas? Here's the code...
choice.user.4:
after.choice:
project = tivkm001.orno
db.retry.point()
select tivkm001.*
from tivkm001 for update
where tivkm001.orno = :project and
tivkm001._compnr = 114
selectdo
db.delete(ttivkm001, db.retry)
commit.transaction()
endselect
location.f = " 0"
location.t = " 600"
db.retry.point()
select tivkm001.*
from tivkm001 for update
where tivkm001.orno = :project and
(tivkm001.loca inrange :location.f and :location.t or
tivkm001.loca = " 1010" or
tivkm001.loca = " 1020") and
tivkm001._compnr = 112
selectdo
db.delete(ttivkm001, db.retry)
commit.transaction()
a.code = tivkm001.code
db.retry.point()
select tivkm001.*
from tivkm001
where tivkm001._index1 = {:project, :a.code} and
tivkm001._compnr = 114
selectdo
db.insert(ttivkm001, db.retry)
commit.transaction()
selectempty
db.insert(ttivkm001, db.retry)
commit.transaction()
endselect
selectempty
endselect
Any ideas? Here's the code...
choice.user.4:
after.choice:
project = tivkm001.orno
db.retry.point()
select tivkm001.*
from tivkm001 for update
where tivkm001.orno = :project and
tivkm001._compnr = 114
selectdo
db.delete(ttivkm001, db.retry)
commit.transaction()
endselect
location.f = " 0"
location.t = " 600"
db.retry.point()
select tivkm001.*
from tivkm001 for update
where tivkm001.orno = :project and
(tivkm001.loca inrange :location.f and :location.t or
tivkm001.loca = " 1010" or
tivkm001.loca = " 1020") and
tivkm001._compnr = 112
selectdo
db.delete(ttivkm001, db.retry)
commit.transaction()
a.code = tivkm001.code
db.retry.point()
select tivkm001.*
from tivkm001
where tivkm001._index1 = {:project, :a.code} and
tivkm001._compnr = 114
selectdo
db.insert(ttivkm001, db.retry)
commit.transaction()
selectempty
db.insert(ttivkm001, db.retry)
commit.transaction()
endselect
selectempty
endselect