Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Local view/cursor does not refresh 1

Status
Not open for further replies.

EdenD

Programmer
Jun 1, 2001
13
0
0
PH
Currently I am working with a library system. I've got a problem with regards to a view which is bound to a combobox. Let me cite 2 transactions which in effect have to 2 tables: Requesting of Titles to be Bought Transaction --> "tblRequest.dbf" and Title Quotation Transaction -> "tblQuot.dbf". The scenario is all requested titles should be price quoted so in the Quotation form, I created a view which is a result of joining 2 tables -> the "tblRequest.dbf" and the author's masterfile "tblmstrauthor.dbf" since I need to get the author's name since in the "tblRequest.dbf" only the author_id is stored. This view, let's name it "requestview", is bound to a combobox which is an object the Quotation form. When I add a record in the Request transaction through the Request form, then I go to the Quotation form to access the request and make a quotation, the combobox list does not include recently added request record...which I think is caused by the "requestview" not being refreshed. When I quit the system and acces the Quotation form, the combobox now reflects the last request transaction. Can any one advice me as to how I can reflect in the combobox all request transactions including the recently added request without quitting the system? Pls help me since I'm way behind my due date because of this.... Thanks a lot
 
In the GotFocusEvent put the code to requery.
This will solve your problem ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Ramani,
Can you elaborate further when you said i will requery the view in the GotFocusEvent? At GotFocusEvent, I just put -> Requery("requestview") [requestview being the local view] but still it did not work. Is this what you're talking about or another thing? I appreciate very much if you could give me an example of how i can requery the local view. Thanks in advance, ramani.
 
In the ComboBox GotFocusEvent put the code
This.Requery()

i.e. Select the ComboBox
Click GotFocuEvent in the properties window..
Put the code...
This.Requery()
and close and compile

I know sure, you will know this... but dont want to take a chance in explainig... ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Ramani,
I already did this when I was waiting for your response but it still didn't work. At the GotFocusEvent of the combobox, I put
This.Requery()
then, run the program but it didn't work. I noticed that when I quit the program and execute again then check the combobox list, that's the only time that the view reflects the new record. I've got a question:
If View1 is derived from Table1 and I close Table1, does View1 also closes? If the answer to this is yes, then does it mean that I can close Table1 then open it again to refresh View1?
 
Hi!

Did you updated the Requests table/view properly? Seem the problem is in following:

View have buffering 3 or 5
Table have buffering 3 or 5
You require to use tableupdate() command to update view, than update the table.

View have buffering 3 or 5
Table have no buffering
Update is required for view only.

When some of updates mentioned above are not made when you save something to requests, other views based on these data will not reflect new data. This is because in the VFP SELECT - SQL statement (that is used by view to query data) returns data only from disk (Phisical data) and is not aware for any buffered changes in the memory.

Just do a simple test:
Save request, than immediately open another VFP instance in developer mode and see if new request is really saved. If it is not, than the problem is in the buffered data not updated, exactly as I described.

Let us know if this helped.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Vlad,
SELE Table -> select the table
BROW -> check if the record was added. it was indeed added
USE -> to close the table to force the view to refresh
USE Table IN 0 -> open it again
SELE View -> select the view
BROW -> to check if the record was reflected. it was not added

The View here comes from the Table. The record was inserted into the Table successfully but the View does not reflect it. I am really amazed with this! Is this a bug or what? Shocks, it gets into my nerve. HELP! Any workaround?
 
Hi!

You're still do not understand what is going on.
Try following:

SELE Table -> select the table
BROW -> check if the record was added. it was indeed added
&& YES, because it is in memory in buffer. However, you can see if table is buffered using cursorgetprop('Buffering') command. If it is 1 - than the problem just in the use of requery for view
USE -> to close the table to force the view to refresh
&& here is written to disk automatically. You can do the same without close/open table, just use tableupdate()
USE Table IN 0 -> open it again
SELE View -> select the view
requery() - > seems you forget that view requires requery to reflect changes. Just a browse is not enough
BROW -> to check if the record was reflected. it was not added


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top