nolihayati isma
26th June 2013, 18:12
Hi All,

Need your assistance on error below.

During data entry in form type 3...

1)item code displayed as per expected.
2)after db.insert, the item code disapper(blank).
3)Manual refresh also doesnt work.
4)Check in table,item code also no inserted.

But

1)If I exit the form and open again, the item code displayed
2) Check in table, item code also available

Below is my code for db.insert.

field.tssma921.plan:
after.input:
if tssma921.plan = tcyesno.yes then
refresh.curr.occ()
tssma921.seqn = last.seqn
tssma921.prin = last.seqn
tssma921.cins = cins.current
tssma921.item = item.current
display("tssma921.seqn")
display("tssma921.prin")
display("tssma921.cins")
display("tssma921.item")
refresh()
db.insert(ttssma921)
commit.transaction()
else
tssma921.reas = " "
set.input.error("tssma2182.reas")
endif

bhushanchanda
26th June 2013, 21:22
Hi,

I am not sure if this function is available in 4C4, but you can give it a try.

After your commit.transaction try adding refresh.all.occs(). Hope it works for you.

nolihayati isma
27th June 2013, 04:00
Hi,

refresh.all.occs() not available in Baan IV

bhushanchanda
27th June 2013, 07:29
Ok.

Check this link (http://www.baanboard.com/baanboard/showthread.php?t=7231) if it helps you.

vamsi_gujjula
27th June 2013, 15:24
nolihayati isma
i think you should debug and trace the field, that will give you details ,where the values are being changed.

mark_h
27th June 2013, 16:13
I would expect other problems. This looks like an update session and you are updating the same table you are inserting into. Why can't you let them change tmssma921.plan and then hit save. Then after that transaction completes you could then go use something like after.rewrite and insert another record. Really had to say what is best without understanding what you are trying to accomplish.

nolihayati isma
28th June 2013, 04:54
Hi All,

The problem resolved. Will post the code soon.

nolihayati isma
28th June 2013, 05:03
1) I need to db.insert after the plan because i also need to validate the duplicate or non active serial no.

2) There are 2 conditions for item code. If the serial no empty, i need to take data from tssma107(after.input). Else will retrieve from tssma102 (there is function created).

field.tssma921.item:
check.input:
if isspace(tssma921.cins) then
select tssma107.*
from tssma107
where tssma107._index1 = {:tssma921.item}
as set with 1 rows
selectdo
selectempty
set.input.error("tssma9121item")
endselect
endif

after.input:
if isspace(tssma921.cins) then
select tssma107.*
from tssma107
where tssma107._index1 = {:tssma921.item}
as set with 1 rows
selectdo
item.current = tssma107.item
cins.current = " "

selectempty
set.input.error("tssma9121item")
endselect
endif

field.tssma921.plan:
after.input:
if tssma921.plan = tcyesno.yes then
refresh.curr.occ()
tssma921.seqn = last.seqn
tssma921.prin = last.seqn
tssma921.cins = cins.current
tssma921.item = item.current
display("tssma921.seqn")
display("tssma921.prin")
display("tssma921.cins")
display("tssma921.item")
refresh()
db.insert(ttssma921)
commit.transaction()
else
tssma921.reas = " "
set.input.error("tssma2182.reas")
endif

mbdave
11th July 2013, 15:32
Its not recommended to right commit in after.input or any field event.Better right in commit.trasnaction event