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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

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.
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.
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?
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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.
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

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()

Close Tables All

Open in new window

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.
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

From novice to tech pro — start learning today.