Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Buffering (What Gives ??)
Message
From
31/12/1996 10:23:45
Randy Johnson
Canadian Broadcasting Corporation
Winnipeg, Manitoba, Canada
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00016068
Message ID:
00016235
Views:
36
>>>>>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 ... :-)
>>
>>Why are you using two forms???? Can you put the grid on the same form?
>>
>>Craig
>
>You can have the grid "popup" by changing the visible property. Start with the grid NOT visible, then when you wish to display it change the property to visible. This way it doesn't need to take a lot of screen space. It can cover other fields temporarily.
>
>Barbara Paltiel

I solved the problem by passing the second form the current recno() that the grid is sitting on. (ie. do myform with nCurrentRecord). I then goto that record in the init method of the second form and the proper data is displayed for editing. Combined with tableupdate() and tablerevert() it seems to fill the bill quite nicely ... Not entirely sure on what kind of errors I can expect on collisions in a multiuser enviroment, but I guess I'll muck around with it until I figure it out as well. Thanks for all the replys ...
Previous
Reply
Map
View

Click here to load this message in the networking platform