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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save status 1

Status
Not open for further replies.

1836

Technical User
Jun 19, 2008
18
HI...Is there a way to save the current 'status' of Foxpro, so that you can 'close data' and call another program & then return to the calling program and 'restore' the status.
thank you
 

Take a look at CREATE VIEW / SET VIEW TO pair to take care of the data, and SAVE TO / RESTORE FROM for the memory variables and arrays.
 
In most versions of VFP, you can do the following:

1. Open the Command Window.

2. Go into Tools / Options.

3. Hold down the Shift key, and click OK.

All the settings will then be copied into the command window, from where you can paste them into a PRG.

This worked at least until VFP 7.0, but I think they dropped it some time after that.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 

Mike, for me, the keywords in the OP were "you can 'close data'", so I was thinking that it's not really settings that 1836 wants to save, but tables and variables state.

But you may be right.

SET( ) function is usually good in saving/restoring many of the settings (not all, though).
 
Unfortunately, CREATE VIEW/SET VIEW aren't really a good idea. They don't store all the info needed to restore the exact data environment. For example, record pointers aren't included.

On the whole, it's better to just use private data sessions, open things shared, and avoid the need to close all your tables and then reopen them.

Tamar
 
thanks to all. in the case that i need it now i realized that i have to be concerned only about 1 file, so it is not the problem that i taught that it whould be. i may try to write a in the future a function to save all this data using the select() function & will share it with you. thanx again!
 
For saving the datasession AUSED() can also be helpful, as you can loop through the result array and add a column to store Recno() info. But indeed it's much easier to start a new datasession and work in there, if you want to preserve everything in the active datasession and don't need the result within the current datasession.

But one problem arises, if you call an object, because that will live in whatever datasession it was created in and to change it to another datasession is not possible from outside, you'd need to add a method in that class to set the datasession, as simple as LParameters tnDatasession / Set Datasession To tnDatasession.

Even though I wonder what your called method/object/function/module does to interfere with your open data. If it eg works on hardcoded work area numbers, it's bad designed.

@Mike, you can still make VFP output all settings the same way, it's only routed to the debugout window now. So you simply need to open the debugger and then do as you suggested and the SET commands will be echoed there. You already have forgotten that you knew this ;-).

Bye, Olaf.
 
Olaf,

@Mike, you can still make VFP output all settings the same way, it's only routed to the debugout window now....You already have forgotten that you knew this

You are completely correct. I did read about that change in the Help, and I did try it out at the time, and I did completely forget that I had done so.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Never mind. It's easier to learn something comletely new than to change habits.

Bye, Olaf.
 
It's easier to learn something comletely new than to change habits.

And this is why I'm doing the column I am in FoxRockx. Trying to get people to go back and look at some of the newer things that they didn't check out along the way. It's also the topic for one of the Southwest Fox sessions: "We Used To Do it That Way, But ..."

Tamar
 
Hi Tamar,

I considered going to Southwestfox. There is a slight chance and I'd like to meet several people there. It's a matter of limited vacation and the workload that prevents me from coming.

I'd strongly recommend anyone who can, to go there.

Bye, Olaf.
 
I hope you make it. We're really excited about the content. Cathy Pountney spoke at my local user group this week to practice and the session was great.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top