harlowm
13th December 2010, 23:30
I have a multi-occurence form which has an indexed field that is populated when I call a function that reads a custom table to get the next available record #. This function is called in the before.write section of main.table.io . When I execute an update.db after a record, the focus jumps to the second record on the form instead of continuing on to the next line. I have tried several different places to call the update, and different ways to move within the occurrences but nothing gets me to a new record correctly. What can I do? :confused:
harlowm
21st December 2010, 22:52
Do not use the command execute(update.db). I found that one session required the do.occ command, the other just required a function call:
"do.occ" method:
field.tihot030.tclos: |This is the last field on the row
after.field: |-only update if index = 0 (0 means this is a new line)
if tihot030.tube = 0 then |-this is the indexed field
do.occ(actual.occ,update.line,actual.occ)
endif
function get.next.record.number()
{
db.retry.point()
select tcjmc047.*
from tcjmc047 for update
where tcjmc047.ckon = 26
selectdo
tcjmc047.ffno = tcjmc047.ffno + 1
tihot030.tube = tcjmc047.ffno
db.update(ttcjmc047, db.retry)
display("tihot030.tube")
commit.transaction()
endselect
}
function update.line(long line)
{
long row
for row = 1 to filled.occ
if tihot030.tube = 0 and line = row then
get.next.record.number()
endif
endfor
}
|**********************
Function method:
field.tihot035.smds: |This is the last field on the row
after.field: |-only update if index = 0 (0 means this is a new line)
if tihot035.test = 0 then |-this is the indexed field
update.line()
endif
function get.next.record.number()
{
db.retry.point()
select tcjmc047.*
from tcjmc047 for update
where tcjmc047.ckon = 27
selectdo
tcjmc047.ffno = tcjmc047.ffno + 1
tihot035.test = tcjmc047.ffno
db.update(ttcjmc047, db.retry)
display("tihot035.test")
commit.transaction()
endselect
}
function update.line(long line)
{
long row
for row = 1 to filled.occ
if tihot035.test = 0 then
get.next.record.number()
endif
endfor
}