david7
7th October 2010, 12:57
Hi All,
I want to be able to lock a record in a table for some time (other records on the same table should be editable). for example I want to lock a specific item, in tiitm001. I dont want anyone to edit it. After a while, I would like to release this lock.
Is there a baan function for this, or anything else?
Any ideas?
- D7
Kozure Ohashi
7th October 2010, 15:07
Syntax
long appl.set( string name(.), long mode )
Description
This creates an application lock for the current application.
Arguments
name The name of the application lock. This must be unique.
mode The type of application lock to set:APPL.READ
APPL.WRITE
APPL.EXCL
APPL.WIDEYou can combine APPL.WIDE with any one of the other lock types.
Return values
0 success
-1 application-wide lock present
-3 internal error
>0 application lock already present; mode is returned
Context
3GL function library.
Examples
This example sets a write-type application lock for all companies. Only the owner can modify the application's data in all companies.
appl.set("00112334455", APPL.WRITE + APPL.WIDE)
This example sets an exclusive-type application lock on a production order and subsequently deletes it.
if appl.set( "tisfc001" & tisfc001.pdno, APPL.EXCL ) <>0 then
| Lock is already present, give message
return
endif
. . . .
appl.delete( "tisfc001" & tisfc001.pdno )
Available Commands are:
appl.set
appl.delete
appl.get.user
appl.modify
Regards,
Kozure
baan_guru
13th October 2010, 14:25
Hi following code can be useful
long tab, tmp
tab = db.bind("ttiitm001")
db.retry.point()
tiitm001.item = " 1" | ANY ITEM CODE FOR MATCH
tmp = db.eq(tab, DB.LOCK) | IF tmp = 0 THEN RECORD FOUND AND LOCKED
tiitm001.usab = 1000
db.update(tab, db.retry)
commit.transaction()
db.unbind(tab)