Where do I put rlock() procedures in screens?

Where do I put rlock() procedures in screens?

Post by Darrel Dav » Tue, 03 May 1994 05:10:10



I have come upon an interesting problem in our new FPW app.  There
are five users on a system that accesses the same tables.  When the
data input screens are opened, they all go to the 1st record.  Since
we are using exclusive off, the record is (correctly) locked.  What
I would like is for the a procedure somewhere in the screen to say,
when rlock()=.F.
skip 1
until it finds a record that is available to the user.  Where do I
put this? In the screen setup? in the WHEN block?

Any help appreciated.

-> Darrel <-
--
--------------------------------------------------------------

*                                                            *
--------------------------------------------------------------

 
 
 

Where do I put rlock() procedures in screens?

Post by Justified And Ancien » Tue, 03 May 1994 07:24:40




>I have come upon an interesting problem in our new FPW app.  There
>are five users on a system that accesses the same tables.  When the
>data input screens are opened, they all go to the 1st record.  Since
>we are using exclusive off, the record is (correctly) locked.  What
>I would like is for the a procedure somewhere in the screen to say,
>when rlock()=.F.
>skip 1
>until it finds a record that is available to the user.  Where do I
>put this? In the screen setup? in the WHEN block?

You should put it in the screen setup procedure.  Or, you can check
the READ NOLOCK box on the screen generator.

But do you really want them editing the information directly out of
the database?
--

=My thoughts, my posts, my ideas, my responsibility, my beer, my pizza.  OK???=



 
 
 

Where do I put rlock() procedures in screens?

Post by Allen J. Friedm » Wed, 04 May 1994 21:08:04


: I have come upon an interesting problem in our new FPW app.  There
: are five users on a system that accesses the same tables.  When the
: data input screens are opened, they all go to the 1st record.  Since
: we are using exclusive off, the record is (correctly) locked.  What
: I would like is for the a procedure somewhere in the screen to say,
: when rlock()=.F.
: skip 1
: until it finds a record that is available to the user.  Where do I
: put this? In the screen setup? in the WHEN block?

Actually, I would approach this problem another way.  When the screen
first comes up, the GETs could be disabled, via a check box on the field
dialog in Screen Builder.  I would implement an 'Edit' button that enables
the GETS and locks the record.  This means that a user can look at records
all day long without locking any records, and only lock when a record is
to be changed.

As others have pointed out, you should also consider indirect GETs to
memory variables, so that nobody is actually editing a record.

 
 
 

Where do I put rlock() procedures in screens?

Post by Nicholas W. Tayl » Thu, 05 May 1994 02:23:09




>Subject: Re: Where do I put rlock() procedures in screens?
>Date: 3 May 1994 08:08:04 -0400

>: I have come upon an interesting problem in our new FPW app.  There
>: are five users on a system that accesses the same tables.  When the
>: data input screens are opened, they all go to the 1st record.  Since
>: we are using exclusive off, the record is (correctly) locked.  What
>: I would like is for the a procedure somewhere in the screen to say,
>: when rlock()=.F.
>: skip 1
>: until it finds a record that is available to the user.  Where do I
>: put this? In the screen setup? in the WHEN block?
>Actually, I would approach this problem another way.  When the screen
>first comes up, the GETs could be disabled, via a check box on the field
>dialog in Screen Builder.  I would implement an 'Edit' button that enables
>the GETS and locks the record.  This means that a user can look at records
>all day long without locking any records, and only lock when a record is
>to be changed.
>As others have pointed out, you should also consider indirect GETs to
>memory variables, so that nobody is actually editing a record.

        I'm writing a program now that does exactly this with SET EXCLUSIVE
always OFF.  My program has three distinct modes: Browse, Add, and Edit.  In
Browse mode, the program simply does a SCATTER MEMVAR after moving to a new
record.  Each relevant field has a WHEN clause that returns .F. if not adding
or editing, with the unique ID *never* being modified.

        In Add mode, I simply do an APPEND BLANK and an immediate RLOCK() since
the record pointer now points to the newly appended record, along with a
SCATTER MEMVAR BLANK.  When I'm ready to save, a Save button calls one big
validation routine checks the whole record for errors, placing the cursor over
any offending fields for immediate change.  A simple GATHER MEMVAR and
automatic updating of the unique ID field save the record.

        In Edit mode, since the program comes from Browse mode, I simply RLOCK()
the currently viewed record and proceed like in Add mode when saving.  BTW,
this makes implementing an Undo function rather easy.  Hitting undo does
either a SCATTER MEMVAR BLANK or SCATTER MEMVAR, depending on the mode.  
Escaping out of either mode is also easy--just UNLOCK and return to Browse
mode.  The only caviat is making sure to disable any navigation controls while
in Add or Edit modes.

        Hope it helps.  Indirect memvar editing is *always* safer and more reliable
than direct editing of database records except in the smallest of APPs.

--Nick "will code FoxPro for food" Taylor

*-------------------------------------------------------------------*

Programmer - Computing Applications Division
Oak Ridge National Labs, Martin Marietta Energy Systems presiding

*-------------------------------------------------------------------*
 The founding fathers were just a bunch of guys trying to get out
 of paying their taxes, after all!  -- NWT

 
 
 

1. Qbasic, Putting total screen in disk when SCREEN-mode=13

I can put the whole screen in disk when in screen-mode 0, with the
statements shown below.
Can you tell me how to do this when in screen-mode 9 or other?
My problem is, that these statemens don't work in other modes; do you have
to use another adress?
(This is a question of my 15 year old son Roel.)

REM Saving the screen
DEF SEG = &HB800
BSAVE "filename",0

REM loading the screen
DEF SEG = &HB800
BLOAD "filename"

2. Connecting to Personal Oracle 95

3. Trigger doing UNLOAD to file OR calling Store Procedure doing the UNLOAD to file

4. Another Distribution Agent For Subscription is Running

5. controlling screen objects with procedures not in screen

6. Problem using foxmapi.fll with fpw26

7. programatically putting object in form(screen)

8. Need help putting browse window in screen

9. Questions- putting buttons in a seperate screen

10. PROGRESS V7 PUT SCREEN problem

11. Rlock() does not unlo

12. vfp6 sp3 problem with set reprocess and rlock