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

What is work area?

Status
Not open for further replies.

foxsu

Programmer
Oct 28, 2003
7
MX
Hi everyone.

What is exactly Work area in this example " Sele 34
append blank "
I´m using Visual foxpro 5.0
and how is related to tag and alias?

Thanks
 
foxu

34?

Try ?SELECT()


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Foxsu

Foxpro was created based from the original Dbase technology. In the early days, these types of languages (foxpro, dbase, clipper) were referred to as xbase languages.

Anyway, in the old days we were not able to select a table by its alias name. We had to select it by a work area number.

I.E.

SELECT 1

SELECT 2

As time passed, changes were made to the languages to allow us to use the alias name. This is a great improvement since we no longer need to remember which table is open in which work area. Most programmers realized this and quickly adopted the alias approach. However, some never changed either because they were unaware of the change, or just used to the old way.

To make a long story short. SELECT 34 is select the table that is in work area number 34. As Mike mentioned, you can determine the name of that program with:

? SELECT()

You may wish to change the code so it does not select 34, but selects the alias. I'll assume it is called "master"

Example:

SELECT master

Obviously easier and self-documenting.



Jim Osieczonek
Delta Business Group, LLC
 
Foxsu,

Just to add to the good advice you've already been given:

A work area is a place where you open a table. You open each table in its own work area. When you want to do something with one of your open tables, you 'move to' that table's work area, which you do with the SELECT command.

Work areas are numbered in sequence, starting at 1 and going up to 32,767 (you typically only use a dozen or so work areas at any one time).

It is better to ignore those numbers and to use the table alias instead. The alias is, by default, the same as the table name, but you can give it a different alias if you wish at the time that you open the table. You use the ALIAS clause of the USE command to specify the alias.

There is a notional work area number 0, which means 'the next available work area'. So, the usual way to open a table is to use this command:
USE MyTable IN 0

That means that the table will open in the first free work area. You then use its alias (MyTable, in this example) to reference that work area:
SELECT MyTable
&& do something with the table

The above is highly simplified explanation. Think of it as the least you need to know in order to get started.

Mike


Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top