eric.dizon
12th February 2013, 18:47
I have the code below for a custom session that I have created. The issue I am having when do I know that the session is doing an "Insert" or an "Update" reason being is I want to update my audit fields accordingly based on the state of the session before saving them. I only want to increment the first freee number I am using when it is "Insert" or new record being saved.
Create Date - tdsmi490.crdt, tdsmi490.crby
Last Modified - tdsmi490.lmdt, tdsmi490.lmby
choice.update.db:
before.choice:
if trim$(tdsmi490.suno) <> "" then |Survey No. is not blank.
db.retry.point()
select
tcmcs050.*
from tcmcs050 for update
where
tcmcs050._index1 = {"SUR", :tdsmi490.suno}
as set with 1 rows
selectdo
|Update First Freenumber
tcmcs050.ffno = tcmcs050.ffno + 1
tdsmi490.lmdt = utc.num()
tdsmi490.lmby = logname$
tdsmi490.suno = trim$(tdsmi490.suno) & edit$(tcmcs050.ffno, "999999")
tdsmi490.scre = calculate_score()
db.update(ttcmcs050,db.retry)
commit.transaction()
endselect
endif
Thanks and Regards,
Eric
Create Date - tdsmi490.crdt, tdsmi490.crby
Last Modified - tdsmi490.lmdt, tdsmi490.lmby
choice.update.db:
before.choice:
if trim$(tdsmi490.suno) <> "" then |Survey No. is not blank.
db.retry.point()
select
tcmcs050.*
from tcmcs050 for update
where
tcmcs050._index1 = {"SUR", :tdsmi490.suno}
as set with 1 rows
selectdo
|Update First Freenumber
tcmcs050.ffno = tcmcs050.ffno + 1
tdsmi490.lmdt = utc.num()
tdsmi490.lmby = logname$
tdsmi490.suno = trim$(tdsmi490.suno) & edit$(tcmcs050.ffno, "999999")
tdsmi490.scre = calculate_score()
db.update(ttcmcs050,db.retry)
commit.transaction()
endselect
endif
Thanks and Regards,
Eric