Refresh a Cursor?

I often open several instances of the same table when I want to relate the table to a parent and be able to move the record pointer freely for a lookup. The problem is that if I append a new record in one cursor  it is not immediately visible in the other cursor for the lookup. Is there a way to have a cursor refresh its data from disc periodically?
fmoore0001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pcelbaCommented:
The most reliable way is to close and reopen the table. But you are not saying how several instances of the same table is open. Does it mean one application is running on several PCs and accessing one table on some file server? Or just one table is used several times under different aliases in one instance of your program?

You are also mentioning cursor. How this cursor is created?

You may also look at following commands in the help: FLUSH, SET REFRESH, FLOCK(), RLOCK(), SET AUTOSAVE.
0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
pcelba, you forgot UNLOCK :-)

If you Unlock the record after you save it and you have a proper SET REFRESH then you should be able to see the cursor. Maybe you have a filter on the parent record. All you have to do is move the current record point by GO BOTTOM or LOCATE.
0
fmoore0001Author Commented:
Let's see if I can clarify. We're opening the tables via the form's data environment. The tables are all opened with buffering == 5. We do it that way because it allows the user to UNDO changes to the data if necessary.

We have a table called 'Client' which contains all types of client data, some lenders, some borrowers, some payables. In some cases we need lender, borrower and payable data at the same time. We do this by having three cursors in the data environment all based on the same table, 'Client', but with the record pointer on different records in each cursor. If I make a change to the cursor that represents the borrower those changes will not be visible in the cursor that represents the lender until I do a table update on the borrower cursor then close and reopen the lender cursor? Is there no other way to refresh the lender cursor without closing and reopening it?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

pcelbaCommented:
OK, now we understand changes may be visible after TABLEUPDATE().

BUT it is still not clear how your cursors are created. If they are just different aliases to one table then it should be sufficient to refresh appropriate controls where data are displayed.

If your cursors are created by some query which creates standalone table then you have to recreate such cursors.

Do decide which of above is valid you may issue  LIST STATUS TO FILE YourFile.TXT and look at the file created.

BTW, one more thing is not so clear: Are you using same record of your Client table to store both lender and borrower? I would guess such data should be in different records.
0
Olaf DoschkeSoftware DeveloperCommented:
Pcelba, if it's simply different aliases to the same tables in the DE and the aliases are buffered in buffermode 5, then a new record within the buffer of one alias is only visible within that one alias. There is no way to make that visible in other aliases of the same table, the buffer is bound to the workarea/alias, not to the dbf file. So the only way to see the record in other alias is to save it.

So the short answer is: No, because buffers are not file specific, but workarea specfic.

Bye, Olaf.

A simple demonstration:
Set Multilocks On
OPEN DATABASE HOME(2)+"tastrade\data\tastrade.dbc"
Use tastrade!orders
Use tastrade!orders in 0 again alias orders2

CursorSetProp("Buffering",5,"orders")
Insert Into orders (customer_id) Values ('new')
Go Bottom in orders2

? 'orders :',orders.customer_id
? 'orders2:',orders2.customer_id

Select orders2
Locate For customer_id = 'new'
? found()

Tablerevert(.T.,'orders')
Close Tables All

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fmoore0001Author Commented:
Thanks for the help, guys,   The solution for us was a combination of things.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.