OVERVIEW.............An overview of the File Group Editor
GROUP OPTIONS........Editing the File Group Options
ITEM EDIT............Editing, Adding, Inserting an item in a File Group
APPEND GROUP.........Appending another File Group to a File Group
LOAD GROUP...........Loading the editor with a File Group
SAVE GROUP...........Saving the File Group to a File
DELETE GROUP.........Deleting a File Group from the File Dictionary
IMPORT GROUP.........Importing or Exporting a File Group
OPEN GROUP...........Opening Files in a File Group
OVERVIEW
An overview of the File Group Editor
Description:
The File Group Editor is an Editor that is used to assemble
information about database files, index files, data-drivers,
relations, etc. that belong in a "group" of related database
information. A file group can consist of up to 150
databases, up to 99 index keys per database, and up to 10
parent-child relations per database. An application may
consist of hundreds of file groups. Some applications may
include the same files in different groups during the running
of an application. For example, the files and indexes for
a "Customer" database and a "Sales Order" database might be
included in a group titled "SOENTRY" and the same customer
files but a different group of "Invoice" files might be
inclued in a group titled "INVPRINT".
The File Group Editor may be invoked from the ASSIST menu,
from the dot-prompt via the FILE EDIT command, or from
application code via the DC_FILEEDIT() function.
This editor is used to edit an "array" of file-group
information. The array can be loaded into the editor from
a variety of sources:
1. From the DCFILES.DBF File Dictionary
2. From an Array File
3. From a Function
4. From a "capture" of all open work-areas.
A file group is used in data-driven applications to open a
related set of files for browsing, data-entry, transactions,
reports, etc. This "array" of information contains everything
necessary to restore a complete set of work-areas by using
the DC_WORKRESTORE() function. This function will use the
array of information in the following sequence:
STEP 1 - Opens all database files in the order they appear
in the work group array, using the data-driver(s)
specified. All data-drivers supported by Clipper,
including third-party data-drivers, may be used.
A work group can even consist of databases that
use different data-drivers. If a database does
not exist, it will be created from the field
definition in the Field Dictionary file.
STEP 2 - Opens all index files in the order they appear in
the work group array. If an index does not exist
it will be created from the information stored in
the work group array. Indexes can be created with a
variety of options, depending on the features of the
specified index driver. If an index key does not
match the key in the array, it will be re-created.
STEP 3 - Sets Parent to Child relations in the order that
they appear in the work group array.
See Also:
dc_fileedit()
FILE EDIT
GROUP OPTIONS
Editing the File Group Options
Description:
Each File Group has a set of options associated with it.
To edit the options, select (E) and (O) from the pull-down
menu.
FILE GROUP NAME
Enter a Unique Tag Name of up to 8 Characters for this File
Group. This name is passed to DC_WORKRESTORE() to open the
files.
Ex: "CUSTOMER"
GROUP DESCRIPTION
Enter a Description of this File Group. This description
will appear in the Pick-List when selecting a File Group.
Ex: "My Customers, Orders and Invoices"
DEFAULT DIRECTORY
Enter the Default Drive and Directory to select for opening
or creating the data files and indexes. If none is entered
then the Default Directory posted within the application
will be used.
Ex: "\APPS\CUSTOMER\"
LAST EDIT DATE
This is a non-entry field that displays the last date this
file group was updated and saved to the disk.
LAST EDIT TIME
This is a non-entry field that displays the last time this
file group was updated and saved to the disk.
LAST EDIT USER
This is a non-entry field that displays the User ID of the
last user who made changes to this file group.
See Also:
dc_fileedit()
FILE EDIT
ITEM EDIT
Editing, Adding, Inserting an item in a File Group
Description:
Each FILE GROUP ITEM designates an action for opening a
database, an index, or a relation. The order that the
items appear in the browse-display will automatically be
sorted to group the items together that all relate to the
same parent ALIAS.
To ADD a file group item to the end of the list, select (E)
then (A) from the pull-down menu.
To INSERT a file group time preceding the highlighted item,
select (E) then (I) from the pull-down menu.
To Edit the highlighted item, Press (ENTER) or select (E)
then (E) from the pull-down menu.
An input screen for editing the file-group item properties
will appear. Enter the following information:
FILE TYPE
Enter a single letter code designating the type of action
to perform:
S - Open Database File in SHARED mode
E - Open Database File in EXCLUSIVE mode
I - Open an Index or Define an Index Tag
R - Set a Relation to another Database
FILE NAME
If this item is a type S or E (Database), then enter the
name of the Database file to open, if it exists, or to
create, if it does not exist. It is not necessary to
include the directory path of the database if a DEFAULT
DIRECTORY has been designated under GROUP OPTIONS. If no
extension is added to the file name then the assumed
extension will be the default supported by the selected RDD
(data-driver).
If this item is a type I (Index), then enter the name of the
Index file to open, if it exists, or to create, if it does
not exist. It is not necessary to include the directory
path of the index if a DEFAULT DIRECTORY has been designated
under GROUP OPTIONS or if the index exists in the same
directory as the database file. If no extension is added
to the file name then the assumed extension will be the
default supported by the selected RDD (data-driver).
If this item is a type R (Relation), then this field is not
used.
DESCRIPTION
If this item is a type S or E (Database), then enter a
description of the database file, Ex: "My Customer File".
If this item is a type I (Index), then enter a description of
the Index Key, Ex: "Country Code + Zip Code"
If this item is a type R (Relation), then enter a description
of the relation, Ex: "Customer Number into Invoice File".
---------[ DATABASE INFORMATION - TYPE 'E/S' ]-------------
FILE ALIAS
Enter the file alias to assign to the database when it is
opened. This should be the same name as the Alias assigned
to the Field Group in the Field Dictionary.
FILTER
Enter a Filter Expression to use with this database. If left
empty, then no filter will be used.
Ex: "!Deleted() .AND. !Empty(user_id)"
DATA DRIVER (RDD)
Enter a Database Driver to use for this database.
Ex: DBFCDX
SUPER RDD
Enter a Super Database Driver (RDD) to use for this
database. This is usually the same as the DATA DRIVER and
will default to the same value as the DATA DRIVER if left
empty. A Super RDD is required only when the DATA DRIVER
is the type that requires a Super RDD, such as FLEXFILE
or DBFMEMO.
RECORD NUMBER
Enter the record number to select when this database is
opened.
0 = Go to the TOP of the file
-1 = Go to the BOTTOM of the file
-2 = Go to the END of the file ( EOF() )
(n) = Go to the specified record.
---------[ INDEX INFORMATION - TYPE 'I' ]-------------
FILE ALIAS
Enter the FILE ALIAS of the Database that is used with this
index. This should be the same name as the Alias of a
type E/S Database included in this file group.
COMBINED INDEX?
Enter a Y for YES if this index is part of a combined index,
such as a .CDX or .MDX index that contains. Enter a N for NO
if it is a single index file such as a .IDX, .NDX or .NTX.
INDEX TAG NAME
Enter a Unique Tag Name to assign to this index. This must
not be the same name as another other indexes for the same
database alias.
Ex: "CATEGORY"
INDEX KEY EXPRESSION
Enter a Valid CLIPPER Index Key expression for this index.
When the index is opened, this Key expression will be
compared to the Key expression in the actual index to insure
its validity. If the index file or tag does not exist, then
this key will be used to create the index.
Ex: "command + sort + Str(page)"
INDEX CONDITION
Enter a Valid CLIPPER expression to be used for inclusion
of records in this index.
Ex: "zip_code = "9"'
UNIQUE INDEX?
Enter a Y for YES if this index requires a unique key for
each key. Enter a N for NO if duplicate keys are allowed.
DESCENDING INDEX?
Enter a Y for YES if the index is to be created in
descending order. Enter a N for NO if the index is to be
created in ascending order.
---------[ RELATION INFORMATION - TYPE 'R' ]-------------
PARENT ALIAS
Enter the alias name of the PARENT database for this
relation. This should be the same name as the Alias of a
type E/S Database included in this file group.
CHILD AlIAS
Enter the alias name of the CHILD database for this
relation. This should be the same name as the Alias of a
type E/S Database included in this file group but many not
be the same as the PARENT ALIAS.
PARENT FIELD NAME
Enter the name of the field that relates the Parent
database to the child database. The data value in the
Parent field much match the index key value in the Child
index.
NOTE: Avoid "circular relations". Do not set multiple
relations in which one of the Parent databases becomes
a Child in another relation. This can cause a system
lockup.
See Also:
dc_fileedit()
FILE EDIT
APPEND GROUP
Appending another File Group to a File Group
Description:
Another file group that exists in the DCFILES.DBF dictionary
may be appended to the existing group in the editor, by
selecting (E) then (A) from the pull-down menu.
Choose the desired file group to append from the pick-list.
See Also:
dc_fileedit()
FILE EDIT
LOAD GROUP
Loading the editor with a File Group
Description:
A File Group can be loaded into the File Group editor from
a variety of sources. File Groups are saved to the
DCFILES.DBF dictionary, an array file, or source code, so
they also be retreived for editing, copying or exporting.
File Groups can also be loaded into the editor by scanning
open work areas and reading the Database, Index and Relation
information.
FILE DICTIONARY
To load the Editor with a File Group from the File
dictionary, select (F), (L) and (D) from the pull-down menu
then choose the File Group to load from the pick-list. The
pick-list will display all File Groups that exist in the
DCFILES.DBF file.
ARRAY FILE
To load the Editor with a File Group that was saved to an
array file, select (F), (L) and (A) from the pull-down menu
then enter the name of the *.DCY file to load. Press
(CTRL-ENTER) or double-click the mouse to pop-up a list of
all *.DCY files on the disk.
CODE
To load the Editor with a File Group that was saved to source
code, first you must make sure that the code was compiled and
linked into the .EXEcutable program that the File Group editor
also resides. This may be a dCLIP.EXE program or a custom
program. If you are running the File Group Editor from dCLIP,
then you may exit to the dot-prompt, load the .OBJ file that
contains the source code for the File Group with the OBJ
command, then re-start the File Group editor. Select (F),
(L) and (C) then enter the name of the function to execute.
This function must return a File Group array of the proper
type or an error will occur.
NOTE: The recommended function name to use for assigning a
file group to source code is the name of the File
Group followed by _W(). For example, the function to
call for returning a file group array for the "SALES"
system is SALES_W().
SELECTED WORK AREA
When creating file groups for databases and indexes that
already exist, it is much quicker and simpler to open the
files, either from Dot-Prompt commands or the Assistant, then
"capture" the work area information into the editor.
To load the Editor with a File Group in a single work area,
first you must make sure that the Datafile and Indexes
are all open. If you are running the File Group Editor from
dCLIP, then you may exit to the dot-prompt, open the files
with the USE command and SET INDEX command, then restart
the File Group Editor.
Ex: USE DCHELP
SET INDEX TO DCHELP1, DCHELP2, DCHELP3, DCHELP4
Select (F), (L), then (S) from the pull-down menu. Select
the work area to read.
ALL WORK AREAS
To load the Editor with a File Group in a group of work
areas, first you must make sure that the Datafile and Indexes
are all open and the Relations are properly set. If you are
running the File Group Editor from dCLIP, then you may exit
to the dot-prompt, open the files with the USE command,
SET INDEX command, and SET RELATION command, then restart
the File Group Editor.
Ex: USE CUSTOMER INDEX CUSTNAME, CUSTNMBR
SET TAG TO CUSTNMBR
USE INVOICE INDEX INVOICE NEW
SET RELATION TO CUST_NMBR INTO CUSTOMER
USE INVITEMS INDEX INVITEMS NEW
SET RELATION TO INV_NMBR INTO INVOICE
SELE CUSTOMER
Select (F), (L), then (W) from the pull-down menu. The work
area data will be read into the editor.
See Also:
dc_fileedit()
FILE EDIT
SAVE GROUP
Saving the File Group to a File
Description:
The file group items that are displayed in the Editor can
be saved to the DCFILES.DBF dictionary, an array file, or
source code, for later retreival by the editor or the
the application program.
FILE DICTIONARY
To save the Editor contents to the File dictionary,
select (F), (S) and (D) from the pull-down menu.
CAUTION: Any File Group in the DCFILES.DBF dictionary with
the same name as the group in the editor will be
overwritten. If you do not want to overwrite an
existing group, make sure to assign a unique name
by selecting File Group Options.
ARRAY FILE
To save the Editor contents to an array file, select (F), (S)
and (A) from the pull-down menu then enter the name of the
*.DCY file to create.
SOURCE CODE
To save the Editor contents to source code, select (F), (S)
and (S) from the pull-down menu. Enter the name of the
source-code *.PRG file to create and the name of the function
to assign. The source code can be compiled with the Clipper
compiler, linked into an application then the menu can be
loaded an executed by calling the DC_WORKRESTORE() function
with the array passed back from the function.
NOTE: The recommended function name to use for assigning a
file group to source code is the name of the File
Group followed by _W(). For example, the function to
call for returning a file group array for the "SALES"
system is SALES_W(). The DC_WORKRESTORE() function
will look first to see if the SALES_W() function has
been linked into the program and grab the file array
from this function, otherwise it will attempt to
restore the file array from the File Dictionary.
Restoring from source code is much faster and more
reliable.
WORK FILE
For compatability with dCLIP 3.x WORK (*.DCW) files, a file
group can be saved to a WORK (*.DCW) file. A WORK file
has the same structure as the DCFILES.DBF file, however it
contains only one file group, not a collection of file
groups for an application. The File Group Tag Name is
assigned to the WORK file. For example, a File Group named
CUSTOMER would be save to the File Dictionary with the Tag
name CUSTOMER, to an array file with the name CUSTOMER.DCY
and to a Work file with the name CUSTOMER.DCW. The
DC_WORKRESTORE((cTagName)) function will look first for a
(cTagName).DCW file, otherwise it will attempt to restore
from the File Dictionary.
Select (F) and (W) from the pull-down menu to save the
contents of the editor to a Work file.
See Also:
dc_fileedit()
FILE EDIT
dc_workrestore()
DELETE GROUP
Deleting a File Group from the File Dictionary
Description:
A file group in the in the DCFILES.DBF dictionary can be
deleted by one of two methods:
1. Select (F) and (D) from the pull-down menu. Choose
the file group to delete from the pick-list.
2. From the Dot-Prompt, use the commmand:
FILE DELETE [(cFileGroup)]
See Also:
dc_fileedit()
FILE EDIT
IMPORT GROUP
Importing or Exporting a File Group
Description:
A File Group can be EXPORTed to a file named DXFILES.DBF for
later IMPORTing into another application. For example, let's
say you have 3 separate applications, each with its own set
of dCLIP dictionary files. Each application will have its
own DCFILES.DBF File dictionary. File Groups can be easily
exported to a DXFILES.DBF file. This file has the same
structure as the DCFILES.DBF file so the group can then be
imported to the DCFILES.DBF file of the target application.
To export a File Group, first load the File Group into the
editor, then select (F) and (E) from the pull-down menu.
CAUTION: The File Group will overwrite any Group in the
DXFILES.DBF file with the same group name, so make
sure to change the name first under "Group Options"
to a unique name.
To import a File Group, select (F) and (I) from the pull-down
menu, then select the group to import from the group pick-
list. The list will include the name and description of all
File Groups in the DXFILES.DBF File Group export file. The
current contents of the editor will be replaced by the
imported group.
See Also:
dc_fileedit()
FILE EDIT
OPEN GROUP
Opening Files in a File Group
Description:
The Database, Index and Relation items in the editor can
be tested to insure that the File Group parameters are
correct and that the files will be properly opened when
this file group is later restored with DC_WORKRESTORE().
Select (F) and (O) from the pull-down menu to open all
the files and set the relations. The contents of the
editor array will be passed to the DC_WORKRESTORE()
function to open the files. If there are any problems
with any of the items in the file group, errors will be
reported. It's a good idea, after opening files, to
call the Dot-Prompt interpreter and insure that all the
Databases, Indexes and Relations are properly set. This
can be accomplished by selecting (F) and (P) from the
pull-down menu. An alternative is to Display the
status of all work areas by selecting (F) and (T) from
the pull-down menu.
See Also:
dc_fileedit()
FILE EDIT