Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Buffering (What Gives ??)
Message
 
To
28/12/1996 22:07:27
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00016068
Message ID:
00016119
Views:
40
>>>>Could someone please explain to me what the proper way is of using Buffering and Tableupdate() ?? I'm trying to do something that is fairly simple in a mutiuser situation. I have 2 forms, a main form displaying several tables using a page frame with grids for each table. One of the pages and it's associated grid will contain records that will be added to the other tables (grids and page frames) once authorization has taken place. Currently the tables have no buffering and are relying on the main form's optomistic buffering scheme. The second form simply allows one to add or edit a record on the one of the tables in the main form ... The second form has optomistic row buffering enabled on the chosen table from the main form. Before calling the second form I scatter memvar (or blank) depending on what action the user has requested .(edit or add) This seems to work OK until I want to update the main form. If I do an INSERT INTO (SQL) and then a TABLEUPDATE() the main form and the grid
>>>are
>>>>refreshed properly. BUT if I do a GATHER MEMVAR and then a TABLEUPDATE() (as in I only want to edit a certain record from the main form) the grid is updated but the WRONG record is updated ?? What gives ?? Do I have to pass the record # to the second form ?? Can scatter and gather NOT be used with buffering ?? Do I have to go back to the old way of rlock() and lose the advantages of buffering ?? How do ensure that other users will see the updates without having to page up and down in the grids ??
>>>
>>>Don't use SCATTER & GATHER. It isn't necessary with buffering. I would use Optimistc Row buffering on the parent table and Optimistic Table buffering on the child table (grid). When the user moves to another record, closes the form, press the Save button, or Selects Save from the menu, I begin a transaction and loop through all the cursor in the current private data session. Inside the loop, I check if the cursor is buffered. If it is, I do a TABLEUPDATE() on it. If any TABLEUPDATE() fails, I do a rollback and notify the user.
>>
>>> O.K. Let's give this another shot ... It's starting to make sense, BUT.
>>IF I lose SCATTER and GATHER and set the Optimistic Row Buffering on the parent table in the data enviroment of the MAIN form and Optimistic Row buffering on the second form (the add/edit form) strange things still happen. If I set the second form to have a Private data session the form appears with blank fields, if the data session is set to Default the form appears with data from the main form's grid, but NOT the current record that the grid is displaying. How does buffering know whether you are adding or editing records and how do you relate an ADD/EDIT form to your main form ... :-)
>
>
>I use a one-to-many form and put a grid on it, then relate the tables in the Data environment. My forms are always in Edit mode, so I don't have to worry about that...except on how to handle Save, etc.
>
>I have a form proptety that holds the current form mode (Add, Edit, Query).
>
>Craig
I agree with not using SCATTER AND GATHER I was an avid user of the, in FOX 2.6 but with table buffering it muuuuuuuuch easier.

The way I handle data integrity so the user won't repeat records like customer name and so on is:

if !tableupdate()
message to the user about the duplicate info
=tablerevert()
else
=tableupdtae()
endif

You coold play around with this and manipulate just certain fields.

Hope it helps.

Alfred Trabulsi
Alfred Trabulsi
Intelexis.
www.intelexis.com
Previous
Reply
Map
View

Click here to load this message in the networking platform