Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Add Records to Updateable Views and Making them visible in Real Time

Posted on 2010-01-12
Medium Priority
Last Modified: 2012-05-08
What is it I am not grokking with Updateable views?

I have  a form whose main table is an updateable view. (the price settings for an account)

I can add a new record to the view, see the result, set the new parameters I want and so on. The form displays how many records I have in the view. That increments correctly.

However, as soon as I move away from the new record, it becomes invisible and I can't get back to it. No filters are active and there is no update conflict. It has correctly inserted the new record into the base table (I'm using optimistic table buffering and doing a forced update any time I move from one record to another) and no other errors or strange behaviour occurs. But until I come out of the view altogether, flush it, and re-use it, I will not see the new record.  

I've even tried doing that in real time and forcing the user to wait thus:
flush in (viewname)
use in (viewname)
flush in (basename)
messagebox('Record Added, Press Any Key to Continue',0,'Record Added',2000)
use (viewname)

and even that will not give me the view with the new record in it!

What step am I missing in order to make the new record visible and available in real time?
Question by:mjacobs2929
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
LVL 14

Expert Comment

ID: 26292656
What command are you using to do a forced update.

Author Comment

ID: 26296918
depending whether I want to update one row or multiple, tableupdate(allrows,.t.) where allrows defaults to .f.
LVL 14

Expert Comment

ID: 26300297
Do you check the value of TABLEUPDATE to see if it has been sucessful. Also is the table on which the view is based also open in buffered mode.
How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

LVL 30

Expert Comment

by:Olaf Doschke
ID: 26301589
First of all you can't set a view to pessimistic locking anyway, but to table or rowbuffering. If you have set it to rowbuffering, your tableupdate() may come after the automatic update and may succeed, while the real direct update did fail. Explicitly set the view to table buffering (DB_BUFOPTTABLE = 5 of foxpro.h) and make your tableupdate the moment before the record pointer moves (in a grid beforerowcolchange).

Then you can really see if the update succeeds or fails. In DB_BUFOPTRECORD (3) mode the automatic update does not give a return value, you have less conrtrol and information what is happening.

Bye, Olaf.

Author Comment

ID: 26302461
Olaf said:
"Explicitly set the view to table buffering (DB_BUFOPTTABLE = 5 of foxpro.h) and make your tableupdate the moment before the record pointer moves"
which is exactly what I am doing.

Bear in mind chaps that we already know the update succeeds (the data always gets through to the base table)


Author Comment

ID: 26302539
tusharkanvinde said:

"Do you check the value of TABLEUPDATE to see if it has been sucessful. "

"Also is the table on which the view is based also open in buffered mode."
Yes but in optimistic Row Buffering, not Table Buffering. Going to try that now...

Author Comment

ID: 26302561
nope, table buffering the base table made no difference...
LVL 14

Accepted Solution

tusharkanvinde earned 2000 total points
ID: 26302662
If the base table is buffered, you have to TABLEUPDATE that too.

Author Comment

ID: 26302722
tusharkanvinde: snuck in under the wire there!

I just logged on to comment that I'd just tried explicitly updating the base table and that it worked; only to find you'd just made that comment.

Help y'self to 500 points

thanks for pointing me in the right direction...

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question