oleska
5th August 2003, 02:57
hello,
Does anybody knows how to implement functionality similar to "Delete Range" on Multi-Occurence form? I need to update range of data and user has to have a option to choose the first and lhe last records. I'm using Baan 5c.
Thanks
NPRao
5th August 2003, 07:36
Oleska,
Please complete your user profile with regards to the Baan software version, Database software and OS version. This will help other members when diagnosing your problem.
Here is a sample code-
for i = 1 to filled.occ
if mark.table(i) then
do.occ(i, delete.records)
endif
endfor
...
function delete.records()
{
|db.retry.point()
select zmmig100.*
from zmmig100 for update
where zmmig100.reqid = :zmmig100.reqid
and zmmig100.stat = :curr.stat
order by zmmig100._index1
selectdo
zmmig100.mplg = logname$
zmmig100.mpdt = utc.num()
| db.update(tzmmig100, db.retry)
| commit.transaction()
endselect
}
If you have this option as a form command, then the standard program handles the transaction management for that main table, else you would need to handle it yourself.
oleska
6th August 2003, 06:29
But your example will work only when records are marked o the form. I have it already and would like to replace it. Let me expalin, user has a choice of Delete range (global.delete) after chosing this option program asks to choose first record and then user can scroll down (500 records) and choose last record. Baan will delete records in that range. I need similar functionality but for update due to user has to update many records.
Thanks,
Zimba
evesely
6th August 2003, 15:41
You could set up a global variable in your program script indicating the status of your "global update". Normally, it would be say 0 (not in function). When the user selects global update, you set it to one and write a message indicating they should pick the first record. You can put code in the "mark.occur" choice to check the status for a value of 1. If so, it will record the pertinent information about the selected record (key fields, table buffer, or something similar), write a message telling the user to pick the last record, and set the status to 2. The the mark.occur choice would again check for a status of two. When this is found, you can launch the code to do the global update since you now have the from and to "keys" or something similar. Of course, you will need to put the appropriate checks in place to set the status back to 0 at the end of the process or if the user cancels out (e.g., hitting ESC) in the middle.
It's not necessarily elegant, but I don't think it would be too cumbersome either.