spartacus
8th January 2003, 19:18
Hi all,
is there any possiblity to store the actual selection of a table in a buffer, make some work on that table, and recall the old values afterwards ?
Thanks
Spartacus
NPRao
8th January 2003, 19:45
spartacus,
Look up for the restore.rcd.main() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_db_operations_restore_rcd_main) in the tools manual.
If you already have the sources then you can do a pattern match for that funciton and you can find the usage.
Also look up for the tccomdll0201 - Handle Cache Memory for more functions.
spartacus
9th January 2003, 10:19
NPRao,
thanks for this hint. I'm not sure, that restore.rcd.main() is the right function. 'Cause I not directly talking about occurences.
My Problem: I would like to upddate a table from a report script, which is already selected in the program script. To be sure that there is no influence to the originally selection in the program script, I thougt I could store the actual selection in a buffer, and restore it, after I updated the table.
But I am not sure, that this is neccessary.
Greetings
Spartacus
Dikkie Dik
9th January 2003, 11:25
I see a few options for you:
- update all the records already in the script but commit later.
- make a array and store all index 1 fields and the fields you want to update.
- When doing a select for update, the records get a lock at that moment. This lock can be stored in an array. What abou the following:
For example, the following code is correct, assuming that the table has three rows.
long i, dlocks(3)
| (delay) lock 3 rows
select *
from ttadv200 for update
selectdo
i = i+1
if ( i>3 ) then break endif
dlocks(i) = ttadv200._dlock
endselect
| update the 3 rows
for i=1 to 3
ttadv200._dlock = i
db.update( tttadv200, db.retry )
endfor
Hope this helps,
Dick