Svidos29
6th June 2018, 18:45
hi all,

i'm selecting in insert of a row some values with my personal function. But when i'm saving the row, in ttaad i see ne record without the 3 values that i'm setting. I'm thinking it's because i do not put any db update, but how can i manage it if i'm in the session of the main table that i have to update?
cisli225 is the main table, here down the code. The values to update are cisli225.exmt cisli225.ceno cisli225.txid

Thanks

function void calcolo.lettera.intento.disponibile()
{
domain tcamnt tmp.amnt
long count.rows

tmp.amnt = 0
count.rows = 0


select cisli220.pfbp
from cisli220
where cisli220._index1 = {:cisli225.sfcp, :cisli225.msid}
selectdo
select tctax100.*
from tctax100
where tctax100.otof = :cisli220.pfbp
order by tctax100._index4 desc
selectdo
select count(*):count.rows
from tctax100
where tctax100.otof = :cisli220.pfbp
selectdo
endselect
if count.rows = 1 then
select tctax910.*
from tctax910
where tctax910.nreg = :tctax100.nreg.c
and tctax910.bpid = :tctax100.otof
selectdo
tmp.amnt = tmp.amnt + tctax910.amnt
selectempty
cisli225.exmt = tcyesno.yes
cisli225.ceno = tctax100.ceno
cisli225.txid = tctax100.cvat
return
endselect
else
select tctax910.*
from tctax910
where tctax910.nreg = :tctax100.nreg.c
and tctax910.bpid = :tctax100.otof
selectdo
tmp.amnt = tmp.amnt + tctax910.amnt
selectempty
break
endselect
endif

if tmp.amnt < tctax100.amnt.c then
cisli225.exmt = tcyesno.yes
cisli225.ceno = tctax100.ceno
cisli225.txid = tctax100.cvat
return
else
return
endif
commit.transaction()
endselect
endselect
}

rahul ingale
6th June 2018, 21:17
If you use dal of cisli225 then you can do it in before save object.also you can do it in UI script using with.object.set.do function but you have to select table 225 and update table in normal way.