//---------------------------------------------------------------------------
// SCHEMA.DEF      NPI Schema object data selectors
//                 Table, MDX, QBE, and Catalog
// Copyright (c) 1991 Borland International, Inc.
//
// This include file contains all the selectors required for tables.
// *** DO NOT CHANGE ANY OF THE NUMBERS BELOW ***
//
//---------------------------------------------------------------------------
// NOTE:
// Selectors listed in the following table which are shown to have
// "Value: Number" will sometimes return the null string instead
// of the numeric zero.  For logical compares, null is the same
// as zero, however when emitting the value to the output file
// the null string must be converted to a numeric zero explicitly.
// A user defined function is used in the FORM.COD template program
// called NUL2ZERO() for converting null strings to explicit numeric
// zeros.
//---------------------------------------------------------------------------
{
selectors
#lstoff
//
// ELEMENT selectors (FOREACH loop elements)
//
ELEMENT             1000, // All elements types by row & column
BAND_ELEMENT        1102, // QBE Skeleton element
FIELD_ELEMENT       1130, // Field element
TAG_ELEMENT         1119, // Index Tag element
EXAMPLE_ELEMENT     1118, //
FRAME_TEXT_ELEMENT  1175, // Element FRAME_TEXT_ELEMENT
//
// Selectors common to all elements
//
ELEMENT_TYPE        001, // Element types found in Tables are:
                         //     BAND_ELEMENT
                         //     FIELD_ELEMENT
                         //     TAG_ELEMENT
GROUP               091, // In QBE, GROUP holds the work area number:
                         // 1 - 8=A Skel .DBF
                         //     9=Work area for calculations
                         //    10=(Unknown - dummy, perhaps?)
                         //    11=View skeleton
ROW_POSITN          092, // Row number of Element - numeric
COL_POSITN          093, // Column number of Element - numeric
SYS_FLEN            053, // Element length in layout
SYS_INAME           068, // reserved
SYS_FMT             071, // reserved
SYS_PAGE            090, // reserved
SYS_ROW             092, // reserved
SYS_COL             093, // reserved
SYS_ATRB            094, // reserved
//
// Frame level selectors - can be accessed at any time
//
NAME                040, // Name of NPI table object - String
FRAME_CLASS         181, // Object type  (QBE always 22)
                         // Value:11=form, 12=label, 13=report
                         //       20=table,21=update,22=query
                         //       23=catalog
FRAME_PATH          042, // Path of object  - String

FRAME_TEXT          120, // Condition Box text.  One for each line in
                         // in the condition box.
// To loop through the condition box text
// Condition box selector {foreach FRAME_TEXT_ELEMENT x
//                            if FRAME_TEXT then
//                                 foreach FRAME_TEXT t in x
//                                      >< FRAMETEXT + CHR(10)><
//                                 next t
//                            else
//                                 >No condition box<
//                            endif
//                         next x>
// <> is used instead of curly braces
//

// Refer to dBASE IV Language Reference - Structure of a Database (.DBF) File
TABLE_MOD_DATE      050, // Date of last update; formatted as mm-dd-yy
                         // Example: 7-1-90 or 12-15-90
TABLE_RECS          051, // Number of records in the database file
TABLE_RECLEN        052, // Number of bytes in the record
TABLE_HAS_MDX       059, // Production .mdx file flag; 01H if there is a
                         // production .mdx file, 00H if not
TABLE_FIELD_CNT     065, // Number of fields in the record

//
// Field attribute selectors (FOREACH Field_element x .... NEXT)
//
FIELD_NAME          150, // Field name of current table: String
FIELD_TYPE          151, // Field data type in table
                         // Value: 67:char 68:date 70:float
                         //        76:logical 77:memo 78:numeric
                         // ( CHR("C") = 67, CHR("D") = 68, etc. )
FIELD_WIDTH         152, // Length of field in table: Numeric
FIELD_DECIMALS      153, // Number of decimal positions for numeric data
FIELD_INDEX         158, // Production .mdx filed flag; 01H if field has
                         // an index tag in the production .mdx file,
                         // 00h if not

//
// Information that pertains to the Production .mdx file
//
MDX_LAST_UPDATE     062, // Date of last .mdx update; formatted like
                         // TABLE_MOD_DATE
MDX_CREATE_DATE     063, // Date .MDX created; formated like TABLE_MOD_DATE
MDX_DBF_NAME        064, // database file name that .MDX goes with

//
// Field attribute selectors (FOREACH TAG_ELEMENT x .... NEXT)
//
TAG_NAME            180, // MDX TAG name of current database file
TAG_DATA_TYPE       182, // Data type of index tag
                         // Value: 67:char 68:date 70:float
                         //        76:logical 78:numeric
TAG_MAX_LEN         183, // Maximum length of tag expression; Max. is 100
TAG_UNQ             184, // Flag indicating unique key; 40H if unique,
                         // not shown if not unique
TAG_EXP             185, // MDX index expression - String
TAG_HOST_TYPE       186, // Reserved for future use
TAG_TYPE            187, // MDX type flag.  One or more of these values
                         // may be set at the same time:
                         // Bit Value   Meaning
                         //   1         dBASE IV ndx file; normally not used
                         //   2         mdx file type; normally not used
                         //   4         mdx file is locked; normally not used
                         //   8         mdx descending index
                         //   16        Index can be used in SQL
                         //   32        mdx distinct index (using SQL)
                         //   64        mdx unique index expression
                         //
                         // Typical values include:  24:Descend Only
                         //                          80:Ascending & Unique
                         //                          88:Descend & Unique
                         //                          16:Ascending only
TAG_ONLY            188, // In QBE skeleton COL_LABEL is only a TAG of a MDX

//
// Information that pertains to the Catalog (.cat) file.
// One for each catalog record.
//
CAT_DELETED         080, // Calalog entry deleted flag; "*" if deleted,
                         // not present if not deleted.
CAT_PATH            081, // PATH field in the catalog (.CAT) file
CAT_FILE_NAME       082, // FILE_NAME field in the catalog (.CAT) file
CAT_ALIAS           083, // ALIAS in the catalog (.CAT) file
CAT_TYPE            084, // TYPE field in the catalog (.CAT) file;
                         // see dBASE IV manual "Using the Menu System",
                         // chapter 3, table 3-1 for the definition of
                         // the types under each panel
CAT_TITLE           085, // TITLE field in the catalog (.CAT) file; this is
                         // the description for the catalog entry
CAT_CODE            086, // CODE field in the catalog (.CAT) file; this links
                         // entries together when the database or view
                         // is selected for use.
CAT_TAG             087, // TAG field in the catalog (.CAT) file, reserved
                         // for future use

//
// Field attribute selectors (FOREACH Band_element x .... NEXT)
// Used to navigate QBE file
SKEL_WA             200, // Skel work area (c.f. GROUP above)
SKEL_TYPE           201, // Skeleton type; 102 ("f") - file skeleton
                         //                107 ("k") - calc'd fields
                         //                99  ("c") - condition box
                         //                118 ("v") - view skeleton
SKEL_GROUPBY        202, // "Group by" flag
SKEL_AGGR           203, // Aggragate function flag
SKEL_UPDATE         204, // What type of Update query
                         // Menu Path: None - Value: 0:QBE 1:Append 2:Replace
                         //                          3:Mark 4:Unmark
SKEL_INDEX          205, // Name of .MDX?
SKEL_NAME           206, // Name of .DBF/Alias
SKEL_UPDATE_TYPE    207, // Four possible values see #204
SKEL_UNIQUE         208, // 1 if pot handle has UNIQUE token
COL_ERR             210, // Error in saved query
COL_DATA_TYPE       212, // Same as #151
COL_DESCEND         213, // "Dsc" flag
COL_UNIQUE          214, // Unique flag
COL_GROUPBY         215, // flag
COL_SORT            216, // flag
COL_AGGR            217, // flag
COL_ORDER_TYPE      218, // Sort order for column
                         // Value: 0:None 1:Ascending 2:Ascending Dictionary
                         //        3:Decending 4:Decending Dictionary
COL_ORDER_NUM       219, // Sort order hierarchy for multiple fields
COL_FIRST           220, // "First" option entered
COL_EVERY           221, // "Every" option entered
COL_GROUPBYX        222, // "Group by" for calc field
COL_AGGR_TYPE       223, // Value:  1=AVG, 2=COUNT, 3=MAX, 4=MIN, 5=SUM
COL_EXAMPLE         224, // Example element in table column
COL_WITH            225, // string COL_WITH
COL_ONLY            226, // string COL_ONLY
COL_EXACTLY         227, // string COL_EXACTLY
COL_NOT             228, // string COL_NOT
COL_TRANSIT_ELEMENT 231, // string COL_TRANSIT_ELEMENT
COL_TRANSIT_LEVELS  232, // number COL_TRANSIT_LEVELS

POTHANDLE           234, // Name of view skeleton; contained in a
                         // BAND_ELEMENT with a GROUP value of 11
VFIELD_WA           240, // View field's original work area
VFIELD_RELFLD       241, // View field's relative position in the view
COL_TEXT            242, // Text under skeleton column; such as Filter
                         // Expressions. The conditions on each line have
                         // a suffix for relnum., where relnum. is the
                         // line number starting from 0.  Example, a
                         // column that includes two lines for comparing
                         // a STATE field for "CA" or "WA" would have two
                         // COL_TEXT values;   0."CA"
                         //                    1."WA"
COL_LABEL           243, // Often the same as Fld_name
COL_RENAME          244, // Rename if used twice (self-join)
COL_SOURCE          245, // Text as it appears "raw" under COL name
                         // Ex:  "CA""WA"  Use COL_TEXT for processing each
                         // line in the field skeleton.
P_DOT               247; // Flag to indicate that the field is in the view
                         // skeleton; Non-zero if present, null if not.
#lston
;
//
// Values returned by Field_type
//
enum tchar =        67,  // Character data maximum length 254
     tdate =        68,  // Date mm/dd/yy
     tfloat=        70,  // Floating point number  10-307  to 10+308
     tlogical=      76,  // logical .t.,.f.,.y.,.n.
     tmemo =        77,  // memo field
     tnumeric =     78;  // numeric
//
// Values of COL_ORDER_TYPE (sort ordering)
//
enum _asc =         1,   // ascending
     _asc_dict =    2,   // ascending dictionary
     _dsc =         3,   // descending
     _dsc_dict =    4;   // descending dictionary
//
// Values of COL_AGGR_TYPE (aggregate operator)
//
enum _avg =         1,   // average
     _count =       2,   // count
     _max =         3,   // maximum
     _min =         4,   // minimum
     _sum =         5;   // sum
}
//-- EOP: SCHEMA.DEF
