Name Command
Obsolete
This command is obsolete. This command is valid only in character-mode DataFlex or BasicReport objects.
Purpose
To permit reference in programs to windows, fields, and constants by names assigned in the program.
Syntax
name
[pagename[.###]] name[... name]
[
name
name ... name]
name [pagename[.###]] name [...name]
pagename may be given either on the name command line or in a preceding autopage command. ### identifies a particular window in pagename to rename. If ### is given in a preceding autopage command instead of in the name command, it must there be preceded by a space instead of a period.
name must not have been previously used (declared) as a name for any other variable.
What It Does
name allows you to address pagename.### as name throughout the portion of your program which comes after the name command line.
name screen.5 turkeys_on_hand_
In this example, the fifth window in Image screen is named turkeys_on_hand_. Below this line, the window may be addressed as either screen.5 or turkeys_on_hand_.
Use of name does not affect addressing pagename.### as pagename.###, nor does it affect window index addressing of the window(s).
Where only pagename is given in the command, naming starts with the first window in pagename:
name screen chickens_ ducks_ capons_ pheasants_ turkeys_on_hand_
In this example, the first five windows of Image screen are named chickens_, ducks_, capons_, pheasants_, and turkeys_on_hand_ respectively. The trailing underscores are not required; they are used only so that it can be seen in lower parts of the program that the names are those of renamed windows.
If an autopage command is in effect, it may be used to imply the windows to be addressed by succeeding name commands which omit all pagename.### references:
autopage screen
name chickens_ ducks_ capons_
name pheasants_ turkeys_on_hand_
This example is the exact equivalent of the name command given in the preceding example, naming the first five windows of Image screen.
Where all the names desired for windows in pagename will not fit on one command line, additional name command lines may be used to name the rest of the windows. In these cases, the introductory autopage pagename command line is required, and the ### specifier may not be used.
Autopage can be started at specific windows other than the first:
autopage screen 3
name capons_ pheasants_ turkeys_on_hand_
In this example, the third window in Image screen is named capons_, the fourth, pheasants_, and the fifth, turkeys_on_hand_.
Notes
-
If needed, the original
pagename.###form of reference to renamed windows may be used, even after a new name has taken effect. -
Names assigned to windows can substitute for all references to the windows, including the arguments to
accept,blankform,clearform,display, andentrycommands, and for references on whichwindowindexloops are based.name maint_log.6 maint_date_ for windowindex from 0 to 3 move today to maint_date_& loopIn this example, the value of variable
todayis moved to Windows 6 through 9 ofImage maint_log, the sixth window having been renamedmaint_date_. -
The name substitutions are done at compile time. Use of
namedoes not involve any processing, or performance cost, whatsoever at run time. -
Nameaffects only the part of your program which is below the name command line. If you desire to use consistent names throughout your program, it is recommended that you place your name command lines at the beginning of your program. -
With
name, you can give names to windows which are indistinguishable from the names of in-memory variables. Where you wish to keep renamed windows distinguishable as windows, it is recommended that you use some naming convention to maintain the distinction, such as a trailing underscore.name address.5 city_In this example, the fifth window of
Image addressis renamedcity_, with a trailing underscore to make it evident throughout your program thatcity_is a renamed window. -
Namecan, in fact, rename any type of DataFlex variable or constant, instead of just windows. For example, if you wished to rename a frequently-referred-to field namedapplication_datein Database Filepersonnel, this command would enable you to refer to it asapdathroughout your program below the command:name personnel.application_date apdaReferences to
personnel.application_datewould continue to work, as well asapda, below the name command line. -
Where the window number (
###) is specified in the name command, only onepagename.###may be renamed.