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

remembering values entered on a form

Status
Not open for further replies.

finglem

Technical User
Nov 14, 2003
66
GB
Hi folks

I've created a form with a few combo boxes that a user can select from and then run a report based on the values selected.
It seems to work pretty well but I'd like the form to remember the values selected the last time the user ran the report.
Is this possible?
 
Thanks Mike but the end user can only run the scx file from within their application so there is no table to store info as such.
I'd rather not be sending them more files than necessary as most of our users just want to see the information and are not always very IT literate they just want to press a button.
Getting them to save files in the right place can be nightmare sometimes.
Is there any way to save the values on the form itself?
 
Hi Finglem

I am not sure I understand your situation. I suppose you have a foxpro executable that your users launch on their workstation. Mike's suggestion is that you write to a file (dbf or txt) the data you want to persist from one session to another. There is no way to write this in the scx. Even if this was possible, your scx would contain the last user's selection not necessarly the current user.

So many options are possible depending on the type of deployement you are using. The simplest approach would be a dbf in the shared data directory. Structure of this table would include the user name, the property name, value and type.


Jean
 
I'd rather not be sending them more files than necessary

Use StrToFile() and FileToStr() to write the value to a text file and read it back. You won't need to distribute the file because the user will create it the first time the program runs. All you'll need is a little bit of code (Try ... Catch ??) to fall back to the default if the text file is missing.

Geoff Franklin
 
thanks guys

I'm a data analyst not a programmer so feel free to laugh if I say something daft.

Jean
basically our software gives the user the option to run either .exe .scx or .xls files to report on their data from within our application (to which I have no access to the source code)

I created the form to give the end user a bit more choice in what data gets pulled into the report. as I said it works ok until the user wants to remember the settings from the last time they ran the report, its not a major issue we can just say "make those selections again" it's that i would like to improve choice.

Geoff

interesting idea i'd like to try but not being a 'real' programmer i'm not sure what i'd need to do. experiment probably, but thanks for the advice
 

Finglem,

If you don't consider yourself a "real programmer", you might need to acquire some basic Foxpro programming skills before you go much further with this.

What you want to do is perfectly feasible, but it does require a little programming. It would be difficult for people in the forum to give you a ready-made fully-tested solution.

I don't mean to discourage you. I just want to point out that, although this is an easy requirement, it involves more than just flicking a switch to make it happen.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike (Lewis)

point noted and (appreciated)

unless I can convince my boss to semd me to one of your sessions like he has with a few other members of our team it's a bit like bangin your head on the wall.

they were sent to you to be able to develop the functionality of the software rather than report on it afterwards (if you know what I mean)

my problem is that I can't convince them that there is hardly any point in a database system being clever if there is no way for an end user to be able to understand and appreciate this and in my opinion the only way they are going to be able to see this is in the form of a report.

I can do this in a number of ways but they are all very limited and require actual facts to base the report on. My idea was to give the end user a little bit of freedom in what they want to see.

I'm willing to put the effort in on my own time so any pointers will be very much appreciated.

Thank you everybody



 

Finglem,

I understand exactly what you mean. I wish there was some easy answer.

unless I can convince my boss to semd me to one of your sessions like he has with a few other members of our team it's a bit like bangin your head on the wall.

I'm curious to know who those other members of your team are. (But I wouldn't expect you to mentiond their names in a public forum.)

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike

Some guys from Lincoln.

They are doing a fantastic job with our app but IMO missing the point of a database system ie How do our users know that the system is doing what we are telling them it does?

I'm trying to improve that but things being as they are I've had to slowly pick things up as I go.

These forums have been a tremendous help and I couldn't have got to where I am now (not far but watch this space...) without them.
 

Finglem,

Some guys from Lincoln.

Ah, yet. That answers the question. Thanks.

Re your original problem with the combo boxes, can you sit down with one of those same guys, and ask him/her to point you in the right direction? It could save you a lot of time.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike

Sounds simple doesn't it? Sit down with one of them.

Believe it or not, they cannot give me the time. They are perfectly happy to pay me to write and rewrite the same old reports with a slight customer specific twist.

I may be crazy but it makes more sense to me to write the report once, give ANY user the ability to see what THEY want to see from it without the need to call me up and request an amendment.

That's what I've done but as I said if the form could remember the settings then hey presto customer gets what they want, the product looks better and I have time to create more reports of the same type to please more of our customers.

But then again I might just be crazy!!!!
 
Finglem,
What about storing that value in an ini-file which remains with the local user?
-Bart
 
In addition:
faq184-2916 gives you the info how to use them.
-Bart
 
Hi Finglem.

I'm a data analyst not a programmer so feel free to laugh if I say something daft.

If you are serious about doing any kind of development in VFP, I suppest you get the following reference book to help you hget up to speed:

Fundamentals: Building Visual Studio Applications on a Visual FoxPro 6.0 Foundation at


Marcia G. Akins
 
Thanks all for your help.

Time to get my hands dirty methinks
 
finglem,

If you're interested, I have a copy of the book that Marcia mentions that I'm no longer using and I'm in the UK as well. My email is scoombs (at) feba-dot-org-dot-uk.

Stewart
 
"I created the form to give the end user a bit more choice in what data gets pulled into the report"

"the end user can only run the scx file from within their application so there is no table to store info as such."

Since you created the form, you can indeed add code to create a temporary data table. By creating the temporary table on the local workstation, you do not have problems with other user's form value entries.

Code:
* --- To Create Temporary Table On Local Workstation ---
mcTempDir = "C:\Winnt\Temp\"
mcNewDBF = ADDBS(mcTempDir) + "TempTable.dbf"

* --- Check If Temp Table Exists ---
IF !FILE(mcNewDBF)
   * --- No Table, Create One ---
   CREATE TABLE (mcNewDBF) FREE (variable list...)  && See VFP Help file
ELSE
   USE (mcNewDBF) IN 0 EXCLUSIVE
   SELECT TempTable
   ZAP  && Eliminate Previous Field Values
ENDIF

" the end user can only run the scx file from within their application"
Have code similar to above exist within one of the appropriate methods of the Form (SCX) file.

Now, as Mike Gagnon suggested above, Store the values in this new Temp table on Exit, and recall them when the form is reloaded.

If you want to get "cute" you could also add an additional field to the table which will hold the Username. In that manner you could hold each user's data as separate records.

Code:
* --- Get Windows Username & Workstation Name ---
mcUserName = SYS(0)  
mcUserName = ALLTRIM(SUBSTR(mcUserName, AT("#",mcUserName) + 1))  && Only Username without Workstation name

Then when you wanted to get just that user's data you could limit the records within TempDBF to only those whose Username was the correct one.

If you were to use the Username approach, the TempDBF would not need to be on the local workstation, but instead on the Server with the other data tables. And it would not be as "temporary" - instead it would remain to time-after-time capture the individual user's data from the form.

Good Luck,
JRB-Bldr
 
stewart

Will respond asap. Thanks

jrbbldr

Thanks for this I'll look into this also.

Many thanks to all

 
Hi Finglem,

I haven't heard from you - or did the spam filter zap your message?

Are you still interested in the book?

Stewart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top