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

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?
mjacobs2929Asked:
Who is Participating?
 
tusharkanvindeConnect With a Mentor Commented:
If the base table is buffered, you have to TABLEUPDATE that too.
0
 
tusharkanvindeCommented:
What command are you using to do a forced update.
0
 
mjacobs2929Author Commented:
depending whether I want to update one row or multiple, tableupdate(allrows,.t.) where allrows defaults to .f.
0
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.

 
tusharkanvindeCommented:
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.
0
 
Olaf DoschkeSoftware DeveloperCommented:
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.
0
 
mjacobs2929Author Commented:
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)

0
 
mjacobs2929Author Commented:
tusharkanvinde said:

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

"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...
0
 
mjacobs2929Author Commented:
nope, table buffering the base table made no difference...
0
 
mjacobs2929Author Commented:
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...
0
All Courses

From novice to tech pro — start learning today.