AIR has seen what I'm trying to do - something that is stupidly flexible and easy to configure for a new user.
Essentially, everything has an ini file (or similar) - all in plain English (or whatever language). right now, with VB, I'm stuck with the ASCII character set, but that
will change in the future. Whatever happens, I'm actually
enjoying writing this software.
Okay, here's the bit I'm currently working on - Index handling.
Like everything else, the primary index is a text file (fixed width record, CrLf termination) and has an external schema.
So - here's a few lines of my test index (yes, it's a part of my mineral collection - makes for excellent test dat for this kind of thing) - there's about 2000 lines of that stuff. The first column is for a "hidden record" flag, and I've trimmed off most of the trailing spaces.
|Unique | |Accession| |other stuff| |Collection | |Analysis | |Field |
|number | |reference| |name | |reference| |reference |
ARC00796 M00796 Minerals
ARC00797 M00797 Minerals F199709144
ARC00798 M00798 Minerals
ARC00799 M00799 Minerals
ARC00800 M00800 Minerals A19990301 F199903261
ARC00801 M00801 Minerals F199903261
ARC00802 M00802 Minerals F199903261
The first two lines
do not appear in the index - they're just for your reference.
And here's the schema for what is actually in there (and I do allow comments in there)
Schema:
Database = Mineral DB
Filename = DBPrimaryIndex.schema
Target = DBPrimaryIndex.index
Size = 148
; Record size of index in bytes - will be padded to fit.
; - the index *is* a random access file, after all.
;
; Type:
; 0 = String
; 1 = Boolean String 'True'/'False'
; 2 = Long Integer
; 98 = Deletion Flag ('D' / 'H' / 'X' / ' ') (= Deleted / Hidden / Expunged / normal)
; 99 = String / Autonumber
; Prefix = (string)
; Body = (picture)
; Suffix = (string)
; Datestamp = null or (picture)
; Class:
; [none] = Default index type (plain secondary index)
; PK = Primary Key (auto numbered sequence number)
; SK = Secondary Key (usually the fully formatted version of the PK,
; which should be an integer
; FG = File Group - by which record cards are arranged on disk
; (directory structure)
; SG = Secondary File Group - by which records without an FG
; value are grouped on disk.
;
Field:
; DELETION flag (Boolean)
Name = Deleted
LPos = 1
Width = 1
Type = 98
Class =
Path = NONE
XPath =
Field:
; Sequential DB entry number - a SUBSET of the ARC Number
; SeqNo
Name = SeqNo
LPos = 5
Width = 6
Type = 99
Class = PK
Path = Main.idx
XPath =
Field:
; Sequential entry number
; ARCNo
Name = ARCNo
LPos = 2
Width = 15
Type = 02
Class = SK
Path = Main.idx
XPath =
Prefix = ARC
Body = 9999999
Suffix = 0
Timestamp = 0
; System timestamp (19 characters for 'Now()' )
Field:
; Accession Number is the specimen reference for
; all accessioned specimens.
; AccNo
Name = Accession No.
LPos = 17
Width = 12
Type = 0
Class = FG
Path = AccNo.idx
XPath= Acquiry Reference
Field:
; Field Number or other reference to material that
; hasn't been accessioned as collection specimens.
; AcqRef
Name = Acqusition Reference
LPos = 29
Width = 24
Type = 0
Class = SG
Path = AcqRef.idx
XPath =
Field:
; Sub Collection Name
; SubColl
Name = SubCollection Name
LPos = 53
Width = 24
Type = 0
Class =
Path = NONE
XPath =
Field:
; Analytical Reference
; Aref
Name = Analytical Reference
LPos = 77
Width = 12
Type = 0
Class =
Path = NONE
XPath =
Field:
; Field Reference
; FRef
Name = Field Reference
LPos = 89
Width = 12
Type = 0
Class =
Path = NONE
XPath =
End:
There will be something similar for the sub-indices (things like dictionary searchable fields etc).
Each schema that gets read into the program joins the schema structure - and, I was surprised when I came up with this, it allows multiple document bases to operate alongside each other natively. With careful arrangement of the fields, it is possible to define a composite field that includes parts of two or more fields concatenated, or even a subset of a single field (SeqNo is the numerical part of ARCNo). As you may have guessed, SeqNo is also the record number in the primary index, and will reference every related item in the system.
(In case you wonder, the short name in the comment is the field mnemonic from the original Access DB)
I have done something similar with the software configuration file - except that I also allow #INCLUDEs in order to allow the stacking of INI parameters to include such things as defaults, new configurations and session information.
You broke the custom config file? Just delete the contents of THAT file, and the configuration reverts to the defaults. There's even a tool for debugging your config
Once I finish the
to do list on that chunk of effort, I'll put it up, too.