VishalMistry
25th March 2011, 11:27
Hi all,

We have a custom update session which gathers data from several table and puts it in single custom table.

I just want to know if there is any way to know if the session is already being executed by some other user ?

This is required to avoid running the session concurrently.

Vishal

Juergen
25th March 2011, 12:26
Hi Vishal,

why not using the application lock functionality for the customized session.

something like this:
before.program:
if appl.set(prog.name$, APPL.EXCL) then
message("Session already running")
end()
endif

after.program:
ret = appl.delete(prog.name$)


Regards,
Juergen

vahdani
25th March 2011, 12:28
Hi,

the standard method is to use application locks (http://www.baanboard.com/programmers_manual_baanerp_help_functions_appl_application_locks_overview).

The session should first try to set an application lock with appl.set() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_appl_appl_set). If it succeeds it then does the updates and when finished removes the application lock using appl.delete() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_appl_appl_delete). If it does not succed it means that someone else is running the session. You can then give theuser a message and exit the session if you want.

PS: Application lock name can be anything you want but it helps tohave a name which is understandable.

VishalMistry
26th March 2011, 06:10
Hi,

It served our purpose. Thanks a lot you all Geeks.

Vishal

Regards,

Hi Vishal,

why not using the application lock functionality for the customized session.

something like this:
before.program:
if appl.set(prog.name$, APPL.EXCL) then
message("Session already running")
end()
endif

after.program:
ret = appl.delete(prog.name$)


Juergen