anshul990
27th September 2019, 13:00
Hi I'm facing some issues in update of previous last expiry date with current effective date with same index value. Please help me to solve the issue.



field.tdcus103.effd(effective date):
after.input:
select tdcus103.effd:effd
from tdcus103
where tdcus103._index1 = {:tdcus103.pcck}
order by tdcus103.effd desc
as set with 1 rows
selectdo
endselect

select tdcus103.*
from tdcus103
where tdcus103._index = {:tdcus103.pcck}
and tdcus103.effd < effd
order by tdcus103.effd desc
as set with 1 rows
selectdo
tdcus103.dffd(expiry date) = effd
db.update(ttdcus103,db.retry)
commit.transaction()
endselect

mark_h
27th September 2019, 15:08
What exactly is the error? Are you running all this code in the after input section? I can see all kinds of issues trying to do this. From the looks of the code it seems you are in the middle of a transaction already. Really too hard for me to see what is really happening.

anshul990
30th September 2019, 07:55
let me tell you what i want to do is
for example
i have a product name "A"
table in database consist of three fields(product_name,product_effective_date,product_expiry_date)
so when user enter details for first time of product A then :
A 29/10/2019 5/11/2019
then second time when user again enter detais for same product then expiry date of previous record of product should be effective date of current
for example:
second time i am entering details of A
A 1/11/2019 31/11/2019
then previous record should be looks like:
A 29/10/2019 1/11/2019

mark_h
30th September 2019, 14:41
I think I understand what you are doing - what you do not tell us is what is the error? What type of session are you running? If it is a maintain - I would probably remove the retry in the db.update and the commit transaction.