home *** CD-ROM | disk | FTP | other *** search
- About the DBBaseDeck:
-
- On pages 6-24 through 6-25 of the Manual Supplement For CanDo 1.5,
- several routines are defined which a standard DataBase might use. The
- DBBaseDeck contains these scripts and is designed to allow a user to
- quickly create a running database.
-
- How To Use the DBBaseDeck:
-
- Load DBBaseDeck into CanDo 1.5. The deck already defines a window with
- four buttons on it: "Next" to move to the next record in the database,
- "Previous" to move to the previous record in the database, "Add" to
- indicate that a record is to be added to the database at the following
- location, and "Delete" which deletes the currently displayed record from
- the database. There are also two menu items, "Load" and "Save" to load
- and save the database.
-
- At this point, the contents of the records are not defined. This deck is
- waiting for you to define the records. To do this, all you need to do is
- add Fields, Document Objects, or Toggle Buttons, etc. to the window, and
- make sure that the names of these Objects begin with "." (according to
- the rules on page 6-22 of the Supplement manual) and you can define the
- database of your choice.
-
- For example, click on the "ADD" button on CanDo's main panel, and press
- the Field button. Position the Field on the window somewhere and then
- look at the "Edit a Field" requester. Change the name of the Field from
- "Field#1" to ".Name", and then press "Okay". Return to the main panel
- and select "Browse". Click on the Field which you just created and type
- a name into it. Then click on the "Add" button on that window. You will
- notice that the field has been cleared. Enter another name into the
- field. Now press the "Next" or "Previous" buttons and you will see the
- name you had typed first. You have just created a database of two names!
- You can now add other Fields or Documents to the window, naming them in
- the same fashion as you did the .Name field, e.g. ".Address", ".Phone"
-
- By default, the DBBaseDeck saves the files to "Ram:TestDB.DAT". You can
- change this by editing the Card's AfterAttachment script. The next time
- you run the deck, or move to this card, the correct load/save file will
- be used.
-
- Adding Features:
-
- Two routines are available within the Deck to allow you to easily add
- buttons to search the DataBase for information ("Search For Entry"), or
- to sort the DataBase using a Key as described on page 6-16 of the
- supplement manual ("Sort DataBase"). These routines implement the
- SearchArray and the SortArray commands in a manner which is consistent
- with the rest of the Deck. These two routines work in the same manner
- as the routines described on page 6-24 and 6-25 of the supplement manual.
-
- "Search For Entry"
-
- Nop; ARG1 = "Search Value"
- Nop; ARG2 = "Search Key"
- Nop; example - Do "Search For Entry","Henry",".Name"
- Nop
- Let DataBase[Index] = GetDBOBjects ; Save Current Entry
- SetSearchArrayFlags NOCASE SUBSTRING
- Let OldIndex = Index ;save index in case Arg1 is not found
- Let Index = SearchArray(DataBase,Arg1,Arg2,Index+1) ;Search next entry
- If Not SearchFound ; Check if found it
- Let Index = SearchArray(DataBase,Arg1,Arg2) ; search from beginning
- If Not SearchFound
- Let Index = OldIndex ;not found - goto original index
- EndIf
- EndIf
- Do "Display Entry" ; Display it!
-
- "Sort DataBase"
-
- Nop ; ARG1 = "Sort key"
- Nop ; example - Do "Sort DataBase",".Name"
- Nop
- Let DataBase[Index] = GetDBOBjects ; Save Entry
- SortArray DataBase,NOCASE STRING ,ARG1 ; Sort Data
- Let Index = FirstArrayIndex(DataBase) ; go to first one
- Do "Display Entry"
-
- If you want to add any other functions, be sure that you are preserving
- and setting the display of the Deck as you go.
-
- For example:
-
- Before changing the display, get the current entry's data as follows:
-
- Let DataBase[Index] = GetDBObjects
-
- After any functions or calls, be sure to update the display as follows:
-
- Do "Display Entry" ;Display the entry at the current Index.
-
- If you follow this advice, you should have little trouble in expanding
- the features of this deck.
-
- Have fun!
-
-