simona
16th January 2012, 18:57
Hello,
I have a problem and I don't know how to handle it. I hope you can help...
My DAL script for table tiitc102, when updating a line, should insert/update/delete also in tirou102. But it doesn't... only sometimes (~2 times from 10). I attached the script.
I debugged the dal script and my function after.save.object() is executing... but not writing in tirou102.
Could you please advise? Thank you!
Kind regards,
Simona
|*************************************************************
|* tiitc102 0 VRC B61U l rom
|* dal tiitc102
|* diciu
|* 10-02-01 [11:20]
|*************************************************************
|* Script Type: DAL
|*************************************************************
#include <bic_dal2>
#include <bic_text>
function extern long before.open.object.set()
{
return(0)
}
function extern long after.save.object(long type)
{
table ttirou102, ttiitc102
long ret
if type = DAL_NEW then
select tirou102.*
from tirou102 |||for update
where tirou102._index1 = {:tiitc102.mitm, :tiitc102.opro, :tiitc102.opno, :tiitc102.seqn}
selectempty
|dal.new.object ("tirou102")
tirou102.mitm = tiitc102.mitm
tirou102.opro = tiitc102.opro
tirou102.opno = tiitc102.opno
tirou102.seqn = tiitc102.seqn
tirou102.tano=tiitc102.tano
tirou102.cwoc=tiitc102.cwoc
tirou102.mcno=tiitc102.mcno
tirou102.sutm=tiitc102.sutm
tirou102.rutm=tiitc102.rutm
tirou102.mcoc=tiitc102.mcoc
tirou102.subr=0
tirou102.suba=""
tirou102.whsa=""
if tiitc102.rutm <> 0.0 then
tirou102.prte=60/tiitc102.rutm
else
tirou102.prte=0
endif
tirou102.indt=tiitc102.indt
tirou102.exdt=tiitc102.exdt
tirou102.efco=""
tirou102.exco=""
tirou102.bfls=tiitc102.bfls
tirou102.cont=""
tirou102.crem=""
tirou102.qpnt=0
tirou102.nnts=0
tirou102.desn=""
tirou102.copo=tiitc102.copo
tirou102.scpq=0
tirou102.ploc=""
tirou102.ydtp=tiydtp.not.applicable
tirou102.yldp=100
tirou102.stcf=tcyesno.yes
tirou102.unef=tcyesno.no
tirou102.exin=""
tirou102.fxsu=0
tirou102.fdur=tcyesno.no
tirou102.tlyn=tcyesno.no
tirou102.trls=0
tirou102.most=tiitc102.most
tirou102.mopr=tiitc102.mopr
tirou102.cact=""
tirou102.tuni=tctope.days
tirou102.qutm=0
tirou102.trdl=0
tirou102.mvtm=0
tirou102.dmso=tcyesno.no
dal.new("tirou102", ttirou102, e, true, db.retry)
endselect
endif
if type = DAL_UPDATE then
select tirou102.*
from tirou102 for update
where tirou102._index1 = {:tiitc102.mitm, :tiitc102.opro, :tiitc102.opno, :tiitc102.seqn}
selectdo
tirou102.tano=tiitc102.tano
tirou102.cwoc=tiitc102.cwoc
tirou102.mcno=tiitc102.mcno
tirou102.sutm=tiitc102.sutm
tirou102.rutm=tiitc102.rutm
tirou102.mcoc=tiitc102.mcoc
tirou102.subr=0
tirou102.suba=""
tirou102.whsa=""
if tiitc102.rutm <> 0.0 then
tirou102.prte=60/tiitc102.rutm
else
tirou102.prte=0
endif
tirou102.indt=tiitc102.indt
tirou102.exdt=tiitc102.exdt
tirou102.efco=""
tirou102.exco=""
tirou102.bfls=tiitc102.bfls
tirou102.cont=""
tirou102.crem=""
tirou102.qpnt=0
tirou102.nnts=0
tirou102.desn=""
tirou102.copo=tiitc102.copo
tirou102.scpq=0
tirou102.ploc=""
tirou102.ydtp=tiydtp.not.applicable
tirou102.yldp=100
tirou102.stcf=tcyesno.yes
tirou102.unef=tcyesno.no
tirou102.exin=""
tirou102.fxsu=0
tirou102.fdur=tcyesno.no
tirou102.tlyn=tcyesno.no
tirou102.trls=0
tirou102.most=tiitc102.most
tirou102.mopr=tiitc102.mopr
tirou102.cact=""
tirou102.tuni=tctope.days
tirou102.qutm=0
tirou102.trdl=0
tirou102.mvtm=0
tirou102.dmso=tcyesno.no
|||ret=TEXT.COPY("tirou102.txta", "tiitc102.txtb", "", "", "", "", "", "")
dal.update("tirou102", ttirou102, e, false, db.retry)
endselect
endif
return(0)
}
|simona:
function extern long before.destroy.object()
{
long ret
select tirou102.*
from tirou102 for update
where tirou102._index1 = {:tiitc102.mitm, :tiitc102.opro, :tiitc102.opno, :tiitc102.seqn}
selectdo
|||ret=text.delete("tirou102.txta", "")
dal.destroy("tirou102", ttirou102, e, false, db.retry)
endselect
return(0)
}
function extern long after.get.object(long dir)
{
return(0)
}
function extern long before.get.object(long dir)
{
return(0)
}
function extern long after.change.object ()
{
return(0)
}
function extern after.commit.transaction ()
{
long r
r=2
}
function extern long after.new.object ()
{
return(0)
}
function extern long before.change.object ()
{
return(0)
}
function extern long before.new.object()
{
| The DAL now knows that a new record is about to be created.
return(0)
}
function extern long before.save.object(long mode)
{
long r
if mode = DAL_NEW then
| this is code from before.write subsection
r=2
else
| this is code from before.rewrite subsection
r=2
endif
return(0)
}
I have a problem and I don't know how to handle it. I hope you can help...
My DAL script for table tiitc102, when updating a line, should insert/update/delete also in tirou102. But it doesn't... only sometimes (~2 times from 10). I attached the script.
I debugged the dal script and my function after.save.object() is executing... but not writing in tirou102.
Could you please advise? Thank you!
Kind regards,
Simona
|*************************************************************
|* tiitc102 0 VRC B61U l rom
|* dal tiitc102
|* diciu
|* 10-02-01 [11:20]
|*************************************************************
|* Script Type: DAL
|*************************************************************
#include <bic_dal2>
#include <bic_text>
function extern long before.open.object.set()
{
return(0)
}
function extern long after.save.object(long type)
{
table ttirou102, ttiitc102
long ret
if type = DAL_NEW then
select tirou102.*
from tirou102 |||for update
where tirou102._index1 = {:tiitc102.mitm, :tiitc102.opro, :tiitc102.opno, :tiitc102.seqn}
selectempty
|dal.new.object ("tirou102")
tirou102.mitm = tiitc102.mitm
tirou102.opro = tiitc102.opro
tirou102.opno = tiitc102.opno
tirou102.seqn = tiitc102.seqn
tirou102.tano=tiitc102.tano
tirou102.cwoc=tiitc102.cwoc
tirou102.mcno=tiitc102.mcno
tirou102.sutm=tiitc102.sutm
tirou102.rutm=tiitc102.rutm
tirou102.mcoc=tiitc102.mcoc
tirou102.subr=0
tirou102.suba=""
tirou102.whsa=""
if tiitc102.rutm <> 0.0 then
tirou102.prte=60/tiitc102.rutm
else
tirou102.prte=0
endif
tirou102.indt=tiitc102.indt
tirou102.exdt=tiitc102.exdt
tirou102.efco=""
tirou102.exco=""
tirou102.bfls=tiitc102.bfls
tirou102.cont=""
tirou102.crem=""
tirou102.qpnt=0
tirou102.nnts=0
tirou102.desn=""
tirou102.copo=tiitc102.copo
tirou102.scpq=0
tirou102.ploc=""
tirou102.ydtp=tiydtp.not.applicable
tirou102.yldp=100
tirou102.stcf=tcyesno.yes
tirou102.unef=tcyesno.no
tirou102.exin=""
tirou102.fxsu=0
tirou102.fdur=tcyesno.no
tirou102.tlyn=tcyesno.no
tirou102.trls=0
tirou102.most=tiitc102.most
tirou102.mopr=tiitc102.mopr
tirou102.cact=""
tirou102.tuni=tctope.days
tirou102.qutm=0
tirou102.trdl=0
tirou102.mvtm=0
tirou102.dmso=tcyesno.no
dal.new("tirou102", ttirou102, e, true, db.retry)
endselect
endif
if type = DAL_UPDATE then
select tirou102.*
from tirou102 for update
where tirou102._index1 = {:tiitc102.mitm, :tiitc102.opro, :tiitc102.opno, :tiitc102.seqn}
selectdo
tirou102.tano=tiitc102.tano
tirou102.cwoc=tiitc102.cwoc
tirou102.mcno=tiitc102.mcno
tirou102.sutm=tiitc102.sutm
tirou102.rutm=tiitc102.rutm
tirou102.mcoc=tiitc102.mcoc
tirou102.subr=0
tirou102.suba=""
tirou102.whsa=""
if tiitc102.rutm <> 0.0 then
tirou102.prte=60/tiitc102.rutm
else
tirou102.prte=0
endif
tirou102.indt=tiitc102.indt
tirou102.exdt=tiitc102.exdt
tirou102.efco=""
tirou102.exco=""
tirou102.bfls=tiitc102.bfls
tirou102.cont=""
tirou102.crem=""
tirou102.qpnt=0
tirou102.nnts=0
tirou102.desn=""
tirou102.copo=tiitc102.copo
tirou102.scpq=0
tirou102.ploc=""
tirou102.ydtp=tiydtp.not.applicable
tirou102.yldp=100
tirou102.stcf=tcyesno.yes
tirou102.unef=tcyesno.no
tirou102.exin=""
tirou102.fxsu=0
tirou102.fdur=tcyesno.no
tirou102.tlyn=tcyesno.no
tirou102.trls=0
tirou102.most=tiitc102.most
tirou102.mopr=tiitc102.mopr
tirou102.cact=""
tirou102.tuni=tctope.days
tirou102.qutm=0
tirou102.trdl=0
tirou102.mvtm=0
tirou102.dmso=tcyesno.no
|||ret=TEXT.COPY("tirou102.txta", "tiitc102.txtb", "", "", "", "", "", "")
dal.update("tirou102", ttirou102, e, false, db.retry)
endselect
endif
return(0)
}
|simona:
function extern long before.destroy.object()
{
long ret
select tirou102.*
from tirou102 for update
where tirou102._index1 = {:tiitc102.mitm, :tiitc102.opro, :tiitc102.opno, :tiitc102.seqn}
selectdo
|||ret=text.delete("tirou102.txta", "")
dal.destroy("tirou102", ttirou102, e, false, db.retry)
endselect
return(0)
}
function extern long after.get.object(long dir)
{
return(0)
}
function extern long before.get.object(long dir)
{
return(0)
}
function extern long after.change.object ()
{
return(0)
}
function extern after.commit.transaction ()
{
long r
r=2
}
function extern long after.new.object ()
{
return(0)
}
function extern long before.change.object ()
{
return(0)
}
function extern long before.new.object()
{
| The DAL now knows that a new record is about to be created.
return(0)
}
function extern long before.save.object(long mode)
{
long r
if mode = DAL_NEW then
| this is code from before.write subsection
r=2
else
| this is code from before.rewrite subsection
r=2
endif
return(0)
}