V12-Dbe 3 Manual
V12-Dbe 3 Manual
V12-Dbe 3 Manual
User Manual
(99/06/16)
Table of Contents
TABLE OF CONTENTS.............................................................................................2 INTRODUCTION......................................................................................................11 V12-DBE FOR DIRECTOR.............................................................................11 V12-DBE FOR AUTHORWARE ......................................................................12 ABOUT THIS MANUAL ..................................................................................12 WHERE TO START .........................................................................................13 SYSTEM REQUIREMENTS FOR RUNNING V12-DBE.....................................13 Macintosh Version...........................................................................13 Windows Version ............................................................................13 Macromedia Director.......................................................................13 DO I REALLY NEED TO MASTER LINGO TO USE V12-DBE? ........................14 YOURE NOT ALONE!....................................................................................14 V12-L Distribution List ...................................................................14 FAQs................................................................................................14 Other Online Resources ...................................................................14 Customer Support and Developer Assistance ..................................15 TYPOGRAPHIC CONVENTIONS ......................................................................15 WELCOME TO V12 DATABASE ENGINE ..........................................................16 INSTALLING V12-DBE..................................................................................16 WHAT'S NEW IN VERSION 3.0?.....................................................................17 VERSION HISTORY ........................................................................................18 HOW TO REGISTER YOUR V12-DBE LICENSE .............................................18 FILES NEEDED TO USE V12-DBE.................................................................19 USING XTRAS...........................................................................................................20 WHAT IS AN XTRA?.......................................................................................20 The V12-DBE Xtra..........................................................................21 MAKING AN XTRA AVAILABLE TO DIRECTOR.............................................21 CREATING AN XTRA INSTANCE ....................................................................21
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
CHECKING IF NEW WAS SUCCESSFUL..........................................................21 USING THE XTRA INSTANCE .........................................................................22 CLOSING AN XTRA ........................................................................................22 CHECKING FOR AVAILABLE XTRAS .............................................................23 DEALING WITH PATHNAMES ........................................................................23 PASSING PARAMETERS TO XTRAS ................................................................23 BASIC DOCUMENTATION ..............................................................................24 USING XTRAS WITH SHOCKWAVE ................................................................25 When using Netscape ............................................................25 When Using Internet Explorer ..............................................26 DATABASE BASICS.................................................................................................27 OVERVIEW.....................................................................................................27 What is a Database?.........................................................................27 Records, Fields and Tables...................................................27 Indexes ..................................................................................28 Compound Indexes................................................................28 Database ...............................................................................29 Full-text Indexing ............................................................................29 Flat and Relational Databases..........................................................30 Field Types ......................................................................................32 Typecasting ...........................................................................32 International Support .......................................................................33 Selection, Current Record, Search Criteria......................................33 USING V12-DBE........................................................................................................36 OVERVIEW.....................................................................................................36 V12-DBE BASICS ..........................................................................................36 THE MAIN STEPS...........................................................................................36 STEP 1: DECIDING ON A DATA MODEL ...........................................................38 Defining Identifiers..........................................................................38 STEP 2: PREPARING THE DATA .........................................................................39 TEXT FILE FORMATS ..................................................................................39 Field Descriptors .............................................................................39
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Dealing with Delimiters Ambiguity .................................................40 Virtual Carriage Returns ......................................................40 Text Qualifiers ......................................................................40 Custom Delimiters ................................................................41 Calculated Fields..................................................................41 Processing the Exported Text File ........................................41 Character Sets ..................................................................................42 Dealing with Dates...........................................................................42 DBF FILE FORMATS .....................................................................................42 FIELD BUFFER SIZE ......................................................................................44 STEP 3: CREATING A DATABASE.......................................................................45 DATABASE DESCRIPTORS .............................................................................45 Defining Both an Index and a Full-index on a Field........................46 Alternate Syntax for Creating Indexes.............................................47 Defining Compound Indexes ...........................................................47 Adding Comments to Database Descriptors ....................................48 USING THE V12-DBE TOOL .........................................................................49 SCRIPTING THE DATABASE CREATION ........................................................49 Step 3a: Creating a Database Xtra Instance .....................................50 Step 3b: Defining the Database Structure ........................................50 mReadDBstructure from a Text File.....................................51 mReadDBstructure from a Literal ........................................51 mReadDBstructure from a DBF File ....................................52 mReadDBstructure from V12-DBE.......................................54 mReadDBstructure from FoxPro (Win-32 Only) ..................54 mReadDBstructure from MS Access (Win-32 Only) .............56 mReadDBstructure from MS Excel (Win-32 Only) ...............57 mReadDBstructure from MS SQL Server (Win-32 Only) .....58 Step 3c: Building the Database........................................................59 VIEWING THE STRUCTURE OF A DATABASE ................................................60 STEP 4: IMPORTING DATA INTO A V12-DBE DATABASE............................62 USING THE V12-DBE TOOL .........................................................................62 SCRIPTING THE DATA IMPORTING ...............................................................62 Importing Data with mImport ..........................................................63 Importing from a TEXT File .................................................64 Importing from a Literal .......................................................65
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Importing from a DBF File...................................................65 Importing from V12-DBE .....................................................66 Importing from a Lingo List or Property List .......................67
Importing XML to V12-DBE................................................67
Importing from MS Access (Win-32 only).............................68 Importing from MS FoxPro (Win-32 only) ...........................68 Importing from MS Excel (Win-32 only)...............................69 Importing from MS SQL (Win-32 only) ................................69 IMPORTING MEDIA INTO A V12 DATABASE .................................................70 STEP 5: IMPLEMENTING THE USER INTERFACE.........................................72 USING THE V12-DBE BEHAVIORS LIBRARY ...............................................72 USING LINGO .................................................................................................72 Opening and Closing Databases and Tables ....................................73 Opening an Existing Database .............................................73 Opening a Table ...................................................................73 Closing a Table.....................................................................74 Closing a Database...............................................................74 Selection and Current Record ..........................................................74 Selection at startup...........................................................................75 Selecting All the Records of a Table ...............................................75 Browsing a Selection .......................................................................75 mGetPosition ........................................................................75 mGoNext ...............................................................................76 mGoPrevious ........................................................................76 mGoFirst...............................................................................76 mGo ......................................................................................76 mFind....................................................................................77 Reading Data From a Database .......................................................78 Reading Fields of Type String, Integer, Float and Date.......78 Reading one or more Entire Records....................................79
Reading the Entire Selection ...............................................80 Reading a Range of Records in a String variable ...............80 Reading a Range of Records in a Lingo List .......................80 Reading a Range of Records in a Property List ..................81 Reading the Entire Content of the Current Record..............81 Reading a Record without Setting it as the Current Record 81 Reading the Entire Selection with Special Delimiters .........81 Reading Selected Fields in a Selection ................................82 Reading Records with a Determined Order of Fields..........82
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Formatting Dates.................................................................85
Reading Fields of Type Media ..............................................86 Adding Records to a Database.........................................................87 Updating Data in a Database ...........................................................87 Writing to Fields of Type Integer, Float and String..............88 Writing to Fields of Type Date..............................................88 Writing to Fields of Type Media ...........................................88 Deleting a Record ............................................................................89 Deleting All the Records of a Selection...........................................89 DATA BINDING ..............................................................................................89 Binding Types..................................................................................91 Full Binding ..........................................................................91 Safe Binding (for advanced users)........................................91 Automatic Generation of Members and Auto-binding.....................92 mGenerateMembers..............................................................92 mAutoBinding .......................................................................93 SEARCHING DATA WITH MSETCRITERIA.....................................................93 Simple Search Criteria.....................................................................94 Sorting a Selection (mOrderBy) ......................................................95 Operators .........................................................................................95 Equal (=) ..............................................................................95 Not Equal (<>) .....................................................................95 Less than (<).........................................................................96 Less or equal (<=)...............................................................96 Greater than (>) ...................................................................96 Greater or equal (>=) ..........................................................97 Starts .....................................................................................97 Contains................................................................................97 WordStarts ............................................................................97 WordEquals ..........................................................................98 Difference Between Contains and WordStarts......................98 Complex search criteria ...................................................................99 Partial Selections ...........................................................................100 Checking the Size of a Selection ...................................................100 Managing Styled Text....................................................................101 Searching and Sorting Styled Text Fields...........................102 ERRORS AND DEFENSIVE PROGRAMMING.................................................103 Checking the Status of the Last Method Called .............................103 CheckV12Error...................................................................104
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Errors and Warnings......................................................................104 Lingo Syntax Errors.......................................................................105 ADDITIONAL V12-DBE METHODS ...................................................................106 EXPORTING DATA .......................................................................................106 Exporting in TEXT Format ...........................................................106 Exporting in DBF Format ..............................................................107 CLONING A DATABASE................................................................................107 FREEING UP DISK SPACE (PACKING)..........................................................108 FIXING CORRUPTED DATABASE FILES.......................................................109 PROGRESS INDICATORS ..............................................................................109 Options of the ProgressIndicator property.....................................110 With_Cancel........................................................................110 Without_Cancel ..................................................................110 UserDefined ........................................................................110 None....................................................................................110 User Defined Progress Indicators ..................................................111 Example: spinning a custom cursor....................................111 CHECKING THE XTRA'S VERSION ..............................................................112 CHANGING A PASSWORD ............................................................................112 PROPERTIES OF DATABASES.......................................................................112 Predefined Properties.....................................................................113 ProgressIndicator ...............................................................113 ProgressIndicator.Message ................................................113 VirtualCR ............................................................................114 CharacterSet .......................................................................114 Resources............................................................................114 CurrentDate ........................................................................115 Verbose ...............................................................................115 Months ................................................................................115 ShortMonths........................................................................115 Weekdays ............................................................................116 ShortWeekdays....................................................................116 ErrorLog .............................................................................116 MaxLoggedErrors...............................................................117 SharedRWcount ..................................................................117 DBversion ...........................................................................117 The String Property .......................................................................118
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
String.Language..................................................................118 String.Language.Delimiters................................................118 String.Language.MinWordLength ......................................119 String.Language.StopWords ...............................................119 Custom Properties (Advanced Users) ............................................120 APPENDIX 1: :LICENSING FAQS.......................................................................121 APPENDIX 2: LICENSE AGREEMENT..............................................................123 APPENDIX 3: CAPACITIES AND LIMITS.........................................................126 APPENDIX 4: MULTI-USER ACCESS................................................................128 OPENING A FILE IN SHARED READWRITE MODE .......................................128 MODIFYING A SHARED DATABASE .............................................................129 COUNTING THE NUMBER OF USERS ............................................................129 POSSIBLE CONFIGURATIONS ......................................................................130 APPENDIX 5: MULTIPLE INSTANCES OF A TABLE ....................................131 APPENDIX 6: DELIVERING TO THE END USER ...........................................132 TESTING FOR END-USERS ............................................................................132 APPENDIX 7: PORTABILITY ISSUES ...............................................................133 APPENDIX 8: DATA UPDATING AND SORT ORDERS..................................134 APPENDIX 9: ADVANCED BOOLEAN SEARCHES ........................................136 Workaround #1: Merging Selections ..................................136 Workaround #2: Marking Records .....................................137 Workaround #3: Field Concatenation ................................138 APPENDIX 10: HANDLING DOUBLE-BYTE CONTENT................................139 Storing and Retrieving Data ...............................................139 Indexing, Searching and Sorting Data ...............................139 Work Around.......................................................................140 APPENDIX 11: PRINTING FROM V12-DBE .....................................................141 mPrint and V12 Database Engine ......................................141
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Example #1: printing a specific field in a record ..............142 Example #2: printing multiple records from a V12-DBE selection .............................................................................142 Example #3: printing multiple columns.............................143
PrintOMatic and V12 Database Engine .............................145 APPENDIX 12: OPTIMIZATION USING INDEXES .........................................147 APPENDIX 13: RESOLVING RELATIONS........................................................150 Resolving a One-to-Many Relation.....................................152 Resolving a Many-to-One Relation.....................................152 Resolving a Many-to-Many Relation ..................................153 APPENDIX 14: MODIFYING A DATABASE STRUCTURE ............................155 APPENDIX 15: DATA ENCRYPTION .................................................................156 APPENDIX 16: STRING AND CUSTOM STRING TYPES...............................158 THE DEFAULT STRING .................................................................................158 PREDEFINED CUSTOM STRING TYPES ........................................................160 Searching and Sorting rules for Strings of Type Swedish ..............160 Searching and Sorting rules for Strings of Type Spanish ..............161 Searching and Sorting rules for Strings of Type Hebrew ..............162 USER-DEFINABLE CUSTOM STRING TYPES ................................................163 APPENDIX 17: CHATACTER SETS....................................................................164 WINDOWS-ANSI CHARACTER SET ............................................................164 MAC-STANDARD CHARACTER SET ............................................................165 MS-DOS CHARACTER SET ........................................................................166 APPENDIX 18: V12-DBE METHODS (BY CATEGORY) .................................167 Initialization...................................................................................167 Retrieving Data..............................................................................167 Modifying Data..............................................................................167 Browsing through Data..................................................................167 Searching and Sorting....................................................................167 Importing Data...............................................................................167 Error Management .........................................................................167 Database Structures .......................................................................167 Database Utilities...........................................................................167
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Special Methods ............................................................................167 APPENDIX 19: V12-DBE METHODS (ALPHABETICAL)...............................168 APPENDIX 20: ERROR CODES...........................................................................185 ERRORS .......................................................................................................185 WARNINGS...................................................................................................191 INDEX.......................................................................................................................192
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Introduction
Welcome to V12 Database Engine (V12-DBE), the most powerful and user-friendly cross-platform database management Xtra for Macromedia Director and Macromedia Authorware .
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Where to Start
Before browsing through this User Manual, we recommend that you look at the First Steps. The First Steps contains an introductory tutorial, example scripts, and sample projects to help you get started with V12-DBE and Lingo in a few short steps. You may also benefit from browsing through the Sampler and the Mini-Sample movies. All available for free on INMs web site at http://www.integration.qc.ca/downloads. Please make sure you understand V12 Database Engine's license agreement before proceeding. The full license agreement is at the end of this user manual, in Appendix 2: License Agreement. Answers to commonly asked questioned can be found in the licensing FAQ section in Appendix 1: :Licensing FAQs.
Windows Version
Any PC running Windows 3.1, 95, Windows 98 or Windows NT that is capable of running Macromedia Director plus 1 Mb of free disk-space. The amount of memory allocated to an application cannot be configured on Windows. This means that an application can "borrow" as much memory as needed from the Operating System. It also means that Windows shows unpredictable behaviors when it is short of memory. Try to establish the minimum equipment requirements of your project as conservatively as possible.
Macromedia Director
Macromedia Director version 5.0 or later is required.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
FAQs
INMs FAQs discusses many of the questions that are frequently asked by V12 developers. Please check http://www.integration.qc.ca/products/v12director/faqs/
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
You may want to check alternate Internet resources such as Director-online-User Group (http://www.director-online.com), UpdateStage (http://www.updatestage.com), Maricopa (http://www.mcli.dist.maricopa.edu/director), and the Lingo User Journal (http://www.penworks.com).
Typographic Conventions
Important terms, such as the names of methods, are in bold.
Sample code is indented and printed in a courier font.
Note:
Special annotations and tips are enclosed in boxes like this one.
Although the sample scripts throughout this manual contain both upper and lower case characters, V12-DBE is not case sensitive. This applies to the methods names, the parameters as well as to the actual data.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Installing V12-DBE
The name of this Xtra is V12-DBE for Director.XTR on the Macintosh, V12-DBE for Director.X32 on Windows 9x/NT and V12DBE-D.x16 on Window 3.x. To install the V12-DBE Xtra in your authoring environment: Make sure that Director is closed. Move the V12-DBE Xtra to the Xtras folder located in the same folder as Director. Start Director.
To confirm that V12-DBE is properly installed, check the Xtras menu in Director. You should see "V12-DBE for Director" in the Xtras menu. V12-DBE comes with an on-line help to assist you in the development of your projects. It is an unprotected Director movie that can be accessed by selecting the Xtras>V12-DBE for Director >Help menu. To install it, Move V12Help.DIR and V12Help.V12 to the Director folder. Note V12Help.DIR is itself a project that relies on dynamic data management thanks to V12-DBE. A single Director movie V12Help.DIR is used as a screen layout template and pulls content out of a V12 database depending on users requests. Replacing the V12Help.V12 database behind this movie by another one makes an entirely new content available to the users.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
User Interface.
mGetUnique retrieves unique values of the field that determines selection's order. It is convenient to populate a pop-up menu or a scrolling list with all the possible search values on a given field. See Reading Unique Values of a Field in Step 5: Implementing the User Interface. mBuild accepts an additional parameter, "online", and can create V12 databases that
are compatible to the V12-DBE Online Companion. See Step 3c: Building the Database.
mOrderBy can now properly sort on any field, whether indexed or not. See Sorting a
Selection (mOrderBy) in Step 5: Implementing the User Interface. Table, field and index identifiers must begin with an alphabetic character and must be followed by up to 31 alphanumeric characters. Unlike former versions of V12-DBE they cannot contain spaces or punctuation marks.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE is now a Shockwave-Safe Xtra. It properly runs with Shockwave document ran off a CD-ROM, or any local medium. However, it cannot be automatically downloaded from a Shockwave movie.
Version History
V12 Database Engine version 1.0 was released in 1996 as both an Xobject and Xtra for Macromedia Director 4 and 5. It was essentially meant to serve as an advanced data management system for Director titles with elaborate user interfaces delivered on CDROM, such as games and virtual workshops. V12 Database Engine Xtra version 2.0 was released in early 1998. It focused on making database technology easier to learn an use by Director users. It added features that better suit projects such as electronic catalogs, electronic books, template-based movies, etc. Some of these features are: full-text indexing, simplified database creation , data binding, styled text management, a behaviors library, etc.
Once your copy of V12-DBE is licensed, all new databases you create are automatically stamped as legal and do not show a splash screen. Existing databases are also stamped as legal as soon as they are opened by the registered V12-DBE.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note
Existing V12 database must be opened once in ReadWrite or Shared ReadWrite mode to be stamped as legal. If you open them in ReadOnly mode or from a CD-ROM, they cannot be legalized and the splash screen will continue to appear on computers that do not have the license file. V12-DBE returns a warning when opening unstamped databases in such circumstances.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Using Xtras
This section deals with Xtras and how they are used in Macromedia Director. The V12-DBE Xtra is used as an example throughout the manual. You will be introduced to the basic steps involved in using V12-DBE successfully before you actually begin to work with V12-DBE. This appendix covers: What is an Xtra Making an Xtra available to Director Creating a Lingo Xtra instance Verifying whether the instance was successfully created Using the Lingo Xtra instance Freeing the Lingo Xtra instance
What is an Xtra?
Xtras are components (alternatively know as add-ons, or plug-ins) that add new features to Macromedia Director. Many of Director's own functions are implemented as Xtras. Macromedia Director supports five types of Xtras: Lingo Xtras add new Lingo commands and functions to Director. They must be delivered to the end-users along with your project. To list all available Lingo Xtras, type "ShowXlib" in Director's Message Window. To find out what methods are provided by a Lingo Xtra, type "put mMessageList(Xtra "<the Xtra's name>")" in the message window. Tool Xtras extend Director's features at authoring time. They appear in Director's Xtra menu. Transition Xtras add new transitions to Director's own transitions set. They only appear in Director's Modify > Frame > Transition window. Asset Xtras enable you to create members of new types and place them on Director's stage. They appear in Director's Insert menu. MIX Xtras are translation modules that enable you to import/export foreign media such as WAV, MP3 files, etc.
Xtras for Windows 9x/NT must have a .X32 file extension, as in "V12-DBE for Director.X32". Xtras for the Macintosh generally have the an .XTR extension. The file extension *.X16 is reserved for Xtras for Windows 3.1.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note:
This is a generic approach and works with all Xtras. In V12DBE, the preferred way to check for errors is the V12Status() method. See Errors and Defensive Programming in this manual.
This example shows the structure of the database referred to by gDB in the message window:
put mDumpStructure(gDB)
Closing an Xtra
When the Xtra instance has completed its function and is no longer required, close it by setting the variable that refers to it to 0. Closing an Xtra performs mandatory housekeeping tasks and closes unneeded files. It also frees the memory occupied by the Xtra. All Xtra instances created with New must be ultimately set to 0 once they are no longer needed. Example:
set gDB = 0
Note:
If a V12dbe Xtra instance is not properly set to 0, the file it refers to remains open and cannot be re-opened unless the computer is restarted. In some cases, it can even become corrupted.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
If V12-DBE is installed, you should see V12dbe and V12table listed in ShowXlib's output, as well as all other available Lingo Xtras. Note that this technique applies to Lingo Xtras only.
assumes that "myBase.V12" is in the same folder as Director or the Projector. This is strictly equivalent to:
set gDB = New(Xtra"V12dbe", the applicationPath & "myBase.V12", "Create", "myPassword")
Most of the time, however, placing the database file in the same folder as the movie that uses it is more convenient. Use the pathname Lingo function to get the current movie's folder. Example:
set gDB = New(Xtra"V12dbe", the pathname & "myBase.V12", "Create", "myPassword")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
(variable number of parameters). Each of these methods can be easily identified in the Xtras built-in documentation explained below (see Basic Documentation).
Basic Documentation
In Director, Xtras contain a built-in mechanism that provides documentation for Lingo developers. In the Message Window, type:
put mMessageList(Xtra "V12dbe")
in the Message Window, where Xtra "V12dbe" is the name of the Xtra library, not of an Xtra instance. The above command returns the following Xtra description:
-- "Xtra V12dbe -- part of V12 Database Engine -- Integration New Media, Inc. 1995-1999 -- Please check the on-line help in the Xtras/V12-DBE menu new object me, string databasename, string openmode, * mBuild object me, * mCloneDatabase object me, string databasename mCreateField object me, string tablename, string fieldname, * mCreateFullIndex object me, string tablename, string fieldname, * mCreateIndex object me, string tablename, string indexname, string isunique, string fieldname, string order, * mCreateTable object me, string tablename mCustom object me, * mDeleteTable object me, string tablename mDumpStructure object me, * mEditDBStructure object me + mError object xtraRef, * + mFixDatabase object xtraRef, string databasename, string newdatabasename mGetPropertyNames object me, * mGetProperty object me, string property mGetRef object me mPackDatabase object me, string newdatabasename mReadDBStructure object me, string inputtype, string source, * mRenameField object me, string tablename, string oldfieldname, string newfieldname mSetPassword object me, string oldpassword, string newpassword mSetProperty object me, string property, string value + mStatus object xtraRef mUpdateDBStructure object me * V12Error * * V12ErrorReset * V12Status + mXtraVersion object xtraRef
Methods that expect a fixed number of parameters are those for which each parameter is listed. Methods that accept a variable number of parameters are those followed by a *. Following are a few explanations:
mEditDBStructure object me
means that the mEditDBStructure method requires exactly one parameter: the database instance.
mSetProperty object me, string property, string value
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
means that mSetProperty requires three parameters: the database instance, the property (a string) and the value of the property (a string).
mDumpStructure object me, *
means that mDumpStructure requires at least one parameter, and possibly more (indicated by the asterisk). You must refer to the documentation of this method to know what additional parameters are accepted.
+ mStatus object xtraRef
the leading "+" sign means that mStatus is a static method - a method that can be used with a database instance (i.e. mStatus(gDB)) and a database library instance (i.e. mStatus(Xtra "V12dbe")). Static methods are seldom used in V12-DBE.
* V12Status
the leading "*" means that V12status is a global method - a method that can be used at any time, regardless of Xtra instances. It is only required that the Xtra be present when that function is called. Note: In addition to its built-in documentation, V12-DBE offers detailed on-line help accessible from the Xtras>V12-DBE for Director >Help menu in Director.
Shockwave movies, like projectors, need to handle two files: the V12-DBE Xtra and your V12 database. These files must be placed in a location on the end-user's computer depending on which browser is used, as explained below.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
The database file (filename.V12) must be placed in the same folder as Netscape. If the Shocked movie is used locally (that is, not downloaded by the user from the Web), the V12 database file can also be placed in the same folder as the Shockwave movie.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
What is a Database?
A database is a collection of information that can be structured and sorted. A telephone book is an example of a hardcopy database, and government statistical records are examples of electronic databases. Database management programs such as V12-DBE provide many advantages over hardcopy databases. Unlike using a telephone directory that sorts data in alphabetical order, database software allows you to change the way you sort and view information. Moreover, you can find, modify and update information quickly and easily.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Peppermint Patty
Lebanon
MO
92023
462-6267
Note:
Some database management systems refer to fields as columns and to records as lines or rows. In V12-DBE, the terms remain fields and records.
Indexes
In a telephone directory, information is indexed by last name - a typical way to search for a telephone number. There are directories which index information by order of phone number or address, but any such directory sorts information in only one specific predetermined order. V12-DBE allows you to determine how you want to sort information by defining one or more indexes in a table. When a field is indexed, V12-DBE creates an internal list that can be used to sort and search quickly the data it contains. Non-indexed fields can also be searched and sorted, but at a slower speed. In this example, the address book entries are listed according to an index of the first name field and sorted in ascending order (A to Z), thus appearing in alphabetical order by first name.
Last Name Jordan Brown Pintado Van Damme Peppermint First Name Ann Charles Jack Lucie Patty Address 6772 Toyon Court 30 Saxony Ave. 22 Hoover Ave. 87 Main St. 127 Big St. City San Mateo San Francisco Bowie Richmond Lebanon State CA CA MD VA MO Zip 94403 94115 20712 23233 92023 Phone 349-5353 421-9963 731-5134 315-3545 462-6267
Compound Indexes
A compound index or complex index organizes entries composed of two or more fields, as opposed to simple indexes or indexes, for short which organize singlefield entries. Compound indexes are useful to determine the sorting order of records when some fields contain identical values. In the following example, three records share the same last names (Cartman). Indexing the field LastName alone would certainly force Last Names to be properly ordered. But this would not determine the order in which the Cartmans are sorted.
Last Name Cartman Brown Pintado Cartman Cartman First Name Wendy Charles Jack Lucy Eric City San Mateo San Francisco Bowie Richmond Lebanon State CA CA MD VA MO Zip 94403 94115 20712 23233 92023
If you want your records sorted by Last Name, and by First Name in case of identical Last Names, you define a compound index on the fields LastName and FirstName. The sorted result would then be:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
State CA MO VA CA MD
If you want them sorted by Last Name, and then by State in case of identical Last Names you define a compound index on the fields LastName and State. The sorted result would then be:
Last Name Brown Cartman Cartman Cartman Pintado First Name Charles Wendy Eric Lucy Jack City San Francisco San Mateo Lebanon Richmond Bowie State CA CA MO VA MD Zip 94115 94403 92023 23233 20712
Up to twelve fields can be declared in a single compound index in V12 Database Engine.
Database
A table, its fields and the indexes defined are stored in a database. A database can contain one or more such tables.
In dex
In dex
Table
Addres s 6772 Toyon Court 30 Saxony Ave. 22 Hoover Ave. 87 Main St. 127 Big St. City San Mateo San Francisc o Bowie Ric hmond Lebanon
In dex
Last Name
record 1 record 2 record 3 record 4 record 5
State CA CA MD VA MO
in Field FieldFieldField
in
in
in
Field FieldFieldFiel d
Table Table
Database
Full-text Indexing
Defining an index on a field allows for quick sorting and searching of the first few characters of a field. In some applications typically when fields contain extensive information you need to search for words that appear anywhere in a field efficiently.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
This is where you need to define a full-text index, or full-index for short, on that field. A full-index is an index defined on every single word of a field.
Last Name Jordan Brown Pintado Van Damme Peppermint First Name Ann Charles Jack Lucie Patty Publication Title Soups and Salads for Dummies The Hunchback of the Empire State Building Bounds on Branching Programs Natural and Artificial Intelligence Mastering Soups in 32767 Easy Lessons
In this example, looking for the word "Soup" in the Publication Title field requires a full-index for optimal search performance. If no index is defined on the Publication Title field, the same result can be achieved, but with a slower performance. If a regular index is defined on the Publication Title field, publications that start with the word "Soup" can be quickly located, but publications that contain that word require more time. Full-indexes apply only to fields of type string, including those which contain styled text (see Field Types, International Support and Managing Styled Text). Note: Each index takes up disk space so it is not recommended that all fields be indexed. Full-indexes require much more space than regular indexes. Indexed fields should be limited to those likely to be searched and sorted most often.
For optimal full-text search efficiency, some level of control is required on the way it is performed. For example, indexing trivial words such as "and", "or", "the", etc. (or equivalent words that appear frequently in your application's language) is useless as most records would contain one or more occurrences of those words. Likewise, some applications or languages require that digits be full-indexed whereas others would prefer to ignore them. V12-DBE enables you to fine-tune the behavior of the full-indexes by allowing for the definition of Stop Words (words that must be ignored), Delimiters (characters that delimit word boundaries) and MinWordLength (the size of the shortest word that must be considered for full-indexing).
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
For example, if you want to add information to the entries contained in the address book in our first example, such as the company address and phone number, one way to do this would be to add them to the table:
Last Name Jordan Brown Pintado Van Damme Peppermint First Name Ann Charles Jack Lucie Patty Address 6772 Toyon Court 30 Saxony Ave. 22 Hoover Ave. 87 Main St. 127 Big St. City San Mateo San Francisco Bowie Richmond Lebanon State CA CA MD VA MO Zip 94403 94115 20712 23233 92023 Phone 349-5353 421-9963 731-5134 315-3545 462-6267 Company Rocco & Co. National Laundry Rocco & Co. Presto Cleaning Presto Cleaning Phone 526-2342 982-9400 526-2342 751-5290 751-5290
However, adding this information might lead to the duplicate of information given that some people might be working for the same company. To prevent duplication and to save on disk space and time required to update, you could create a new table containing only the business information. For example, the new table could be called: Companies. Each record of that new table would have a unique ID number, Company Ref, that would also be used in the first table. The database now contains two related tables, each having a field containing the common information, named Company Ref: Table 1 containing information about the each person:
Last Name Jordan Brown Pintado Van Damme Peppermint First Name Ann Charles Jack Lucie Patty Address 6772 Toyon Court 30 Saxony Ave. 22 Hoover Ave. 87 Main St. 127 Big St. City San Mateo San Francisco Bowie Richmond Lebanon State CA CA MD VA MO Zip 94403 94115 20712 23233 92023 Phone 349-5353 421-9963 731-5134 315-3545 462-6267 Company Ref RO NA RO PR PR
The relational database is smaller because it avoids useless data duplication. In order to retrieve full information about any given individual in your address book, you would perform a search in your first table, retrieve the company reference, and then perform a search in the second table. The flat model may be easier to manage when retrieving data given that only one search is required, however it tends to consume valuable disk space.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note
Relational Database Management Systems (RDBMS) are usually programmed with SQL (System Query Language), which has the ability to automatically resolve relations between related tables. Although V12 Database Engine can store multiple tables per database, it relies on Lingo scripts to resolve relations. It cannot automatically such resolve relations.
Field Types
For optimal data sorting and searching, you can specify the kind of information to be stored in each field. In V12-DBE, fields can be designated to contain strings, integers, floating-point numbers, dates, pictures, sounds, palettes, etc. A field would then be of type string, integer, float, date, or media. Fields of type Media can accommodate any media that can be stored in a cast member except for Film Loops and QuickTime movies. See Appendix 3: Capacities and Limits at the end of this manual for a formal definition of each field type. For example, if you wanted to organize a contest where each person listed in your address book is collecting points, you would need to keep track of the number of points accumulated by each person. Therefore, you would update your address book to include a new field: number of points. Since you would want to search and sort this new field quickly, you need to define an index. This new field could be one of two types: string or integer. If you define the new field as type string, you might end up with the following listing when the table is sorted by ascending order of points:
Jordan Brown Peppermint Pintado Van Damme Ann Charles Patty Jack Lucie 1 12 127 6 64
This order occurs because the string "12" is alphabetically lower than the string "6" given that the ASCII code for "1" is 49 which is smaller than the ASCII code for "6", 54. To sort the list in the expected ascending order, you must define the field number of points to be of type integer to get the following result:
Jordan Pintado Brown Van Damme Peppermint Ann Jack Charles Lucie Patty 1 6 12 64 127
Typecasting
Typecasting (or casting, for short) is the process of converting a piece of data from one type to another. This is a common mechanism to most programming languages, including Lingo.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
For example, the integer 234 can be casted to the string "234". Conversely, the string "3.1416" can be casted to the float 3.1416. Typecasting can be performed explicitly in Lingo using the Integer, String and Float functions (i.e., String(234) returns the string "234") or automatically (i.e., 12&34 returns the string "1234"). V12-DBE has the same ability as Lingo to typecast data when it is required by the context. However, some borderline conditions can lead to ambiguous results such as trying to store the value " 123" in a field of type Integer (note the leading space). You must always make sure that the data supplied to V12-DBE does not contain spurious characters, otherwise typecasting will not be performed properly.
International Support
Although the 26 basic letters of the roman alphabet sort in the same order in all roman languages, the position of accented characters (also called mutated characters) varies from one language to another. For example, the letter sorts as a regular a in German whereas it sorts after z in Swedish. Likewise, in Spanish, ch sorts after cz and ll sorts after lz. V12-DBE's default string was designed to satisfy as many languages as possible. It can sort and search texts in English, French, Italian, Dutch, German, Norwegian, etc. See Appendix 16: String and Custom String Types in the appendices of this manual for a detailed description of string's behavior. V12-DBE also offers the option of defining fields of type Swedish, Spanish, Hebrew, etc. that index and sort data in a way that is compliant with these languages. See Appendix 16: String and Custom String Types for an exhaustive list and description of those behaviors called custom string types. The Regular Edition of V12-DBE allows for the creation of custom string types having each a sort/search description table defined by you. Therefore, you can define your own string type for any language supported by single-byte characters, including Klingon. Note: Everything that applies to the type string also applies to custom string types. Throughout this manual, the term string is used to designate both the default V12-DBE string and custom string types.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
If exactly one record satisfies the search criteria, the selection contains only the record which automatically becomes the current record. If two or more records satisfy the search criteria, the selection is the set of those records and the first record of the selection becomes the current record. If no record satisfies the search criteria, then the selection is empty and the current record is undefined. Any attempt to read or write in a field will result in an error.
The following figure illustrates the idea of searching a table for records satisfying a certain criteria. The result is placed in a selection, the first record of which becomes the current record.
All operations on any fields (such as reading and writing data) are done on the current record. Therefore, before performing these operations, you must designate the record on which you wish to work as the current record by selecting it, and by using methods such as mGoFirst, mGoLast, mGoNext, mGoPrevious and mGo. At any given time, with the possible exception of no record satisfying the criteria, there is a current record. All record operations apply to the current record and do not apply to any other record. You can read the content of a field in the current record, modify its content or delete the entire record. The current record is changed when you move from one record to the next in the selection. Besides sorting a table through indexes, you can find information based on search criteria. You can define simple search criteria, also called simple queries, such as: First name is Jack State is California Number of points is less than 30 Last name begins with P Or you can define complex search criteria, also called Boolean queries using and/or, such as: First name is Jack or Last name begins with P State is California and Number of points is less than 30 State is California and Number of points is less than 30 and Last name contains "pe"
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note
Database Management Systems that use SQL as their programming language can define search criteria such as: (Dish is soup or appetizer) and (Main Ingredient is celery or eggplant or pumpkin). V12 Database Engine does not support this alternation of ANDs and ORs. See Appendix 9: Advanced Boolean Searches for possible workarounds.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE Basics
V12-DBE is a powerful database management engine, composed of two Xtras libraries: a database Xtra named "V12dbe" and a table Xtra named "V12table". The database Xtra is used to create a new database or to open an existing database in a given mode (read only, read/write or create). The table Xtra is used to manage the content of the table in your database.
Step 2
Step 3
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Step 4
Importing data into a V12-DBE database: Use the V12-DBE Tool to import the Text or DBF file exported at Step 2. Alternatively, you can write Lingo scripts to automate the process of importing data into your V12-DBE databases. Implementing the user interface: This step consists of the development of data search, retrieval and modification routines at runtime either as Behaviors attached to the various Director sprites, or as Lingo handlers in Director script members. Sample movies provided in the V12-DBE package or on Integration New Media's web site (http://www.integration.qc.ca) can be used to inspire the development of your projects. Each of the aforementioned steps is discussed in subsequent sections. Since V12-DBE offers more than one way to attain a goal, the simplest approach is explained first, then alternate and more powerful or versatile approaches are discussed.
Step 5
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Since only the fields "ItemName", "Price" and "CatalogNumber" will be searchable, only them are indexed.
Defining Identifiers
Tables, field and indexes are given names called identifiers, and V12-DBE makes reference to them by use of these identifiers. An identifier must start with a low-ASCII alphabetic character (a..z, A..Z) and can be followed by any combination of alphanumeric characters (0..9, a..z, A..Z, , , , ). The maximum length for an identifier is 32 characters. No two fields or indexes of a table can have the same name. V12-DBE is not case-sensitive. That is, upper-cases and lower-cases are identical. The following identifiers are considered identical in V12-DBE: "articles", "ARTICLES", "Articles", "aRtICleS".
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
where Field_A1, Field_A2, etc. designate the actual data in those fields. TAB is the ASCII character 9, indicating the end of a field. On the Mac, CR is the ASCII character 13, indicating the end of a record. On Windows, CR is the ASCII character 13 followed by the ASCII character 10 (Line Feed). Since V12-DBE always ignores Line Feed characters, you need not worry about exceptional cases between the Mac and Windows with respect to Record Delimiters. Generally, using the V12-DBE Tool or the mImport method to import a text file into a V12-DBE database is a straightforward process, unless your fields contain TAB or CR characters. In such cases, V12-DBE confuses the real delimiter with the legitimate content of your field. See Dealing with Delimiters Ambiguity below.
Field Descriptors
V12-DBE requires a special type of Delimited Text file format. The file's first line must contain field descriptors, or the names of the fields into which the data that follow must be imported. This file format is sometimes referred to as mail merge format. Following is an example of such a file:
Name Price CatNumber
Ruler
1.99
1431
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Labels Tags
1.19
6.19
1743
You can easily have FileMaker Pro and MS Access export those field names before exporting the records data as follows: In FileMaker Pro, choose File > Import/Export > Export Records and select "Merge (*.MER)" in the Save as Type menu. As a side effect, FileMaker Pro exports your data with quotation marks surrounding each field and a comma as field separator. Your file can easily be imported to the V12 database with quotation marks as Text Qualifiers (Text Qualifiers below) and commas as field delimiters (see Custom Delimiters below). In MS Access, choose File > Save As/Export, to an external file or database. Then, select Text Files in the Save as Type menu. Click Export. Make sure that Delimited is selected and click Next. Click "Include Field Names in First Row".
Text Qualifiers
A text qualifier is special character used to begin and end each Text field. In most database management systems, the quotation mark (") is the default text qualifier. Its main purpose is to group a field's content between two identical marks so to enable the occurrence of field and record delimiters without the risk of confusion. Example:
"Name" , "Description" CR "Hat" , "high-quality, excellent fabric, available in:CRRedCRGreenCRBlue" "Shoe", "this, description, field, contains, commas, and, CarriageCRReturns"
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Text qualifiers are automatically placed in text files exported from MS Access, FileMaker Pro (Mail Merge format) and MS Excel (only for fields that contain commas). Text files containing Text Qualifiers are easily imported to V12 databases by setting the mImport method's TextQualifier property to the right character. See Step 4: Importing Data into a V12-DBE Database / Importing Data with mImport.
Custom Delimiters
Another way to avoid delimiter ambiguity is to choose delimiters other than TAB and CR. Some database management systems allow you to select appropriate delimiters before exporting a TEXT file (e.g., 4th Dimension). Some others allow only the selection of a custom field delimiter and always use CRs as records delimiters (e.g., MS Access). FileMaker Pro and MS Excel do not allow for any customization. V12-DBE's mImport method assumes, by default, that the field and record delimiters are TAB and CR. However, other delimiters can be specified. See Step 4: Importing Data into a V12-DBE Database / Importing Data with mImport. Note Since V12-DBE always ignores Line Feed characters, (ASCII Character 10), those cannot be used as field or record delimiters.
Calculated Fields
If your database management system does not support alternative delimiters you can nonetheless force it to export your own delimiters by creating an additional field and setting it as the result of the concatenation of all the other fields with the desired delimiter in between each two fields. Then, export only the new field in a text file.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Character Sets
Character sets are not standard across operating systems and file formats. For example, the letter "" is the 233rd on Windows, whereas it is the 142nd on Macintosh and the 130th on MS-DOS. Although all three operating systems use the ASCII characters set, only low-ASCII characters (i.e., those below #127) are common to the many variants of the ASCII set. Therefore, the rest of this topic is of interest to you only if your deal with high-ASCII characters (such as , , , , , , , , , , etc.) V12-DBE's CharacterSet property can be set to translate Windows, Macintosh or MS-DOS character sets when importing or exporting Text or DBF files. Optionally, mImport accepts the CharacterSet property to use only once to import a single file (as opposed to the CharacterSet property which permanently affects mImport, mImportFile and mExportSelection, or until it is set to another value). Step 4: Importing Data into a V12-DBE Database / Importing Data with mImport. MS Word documents, V12 databases as well as many other proprietary file formats are cross-platform compatible. You should not worry about this portability issue if your data contains only low-ASCII characters (e.g. English alphabet).
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
on both MacOS and Windows, it can read DBF files of type Dbase III, Dbase IV, Dbase V, FoxPro 2.0, FoxPro 2.5, FoxPro 2.6, FoxPro 3.0 and FoxPro 5.0. on Windows 9x/NT only, DBF files can be exported through the FoxPro ODBC driver.
You may want to export your data as DBF files, if that format is supported by your database management system. DBF is an old file format. It was enhanced over the years but most common applications still use the popular Dbase III format whose features are common to all other DBF file variants. Limitations include: Field names are limited to ten characters, all in upper case, The number of fields per DBF file is limited to 128, Records are of fixed length, determined upon the creation of the DBF file, There is more than one way to deal with high-ASCII characters (accented characters) with DBF files. This depends on the operating system and application used to manage the DBF file, Indexes are saved in separate files with extensions such as IDX, MDX, NDX or CDX (depends on the managing application), DBF files cannot be password-protected. However, some applications protect DBF files by encrypting/decrypting them, Character fields (roughly, the equivalent of V12-DBE's string fields) are limited to 255 characters. Any text longer than 255 characters, must be stored in separate files called DBT files and referred to by Memo fields, Media (either Binary or Text) are stored in external DBT files pointed to by Memo fields in the DBF file. Media fields are limited to 32K of size.
Various flavors of the DBF file format were introduced over the years, such as DBase IV, DBase V, FoxPro 2.0, FoxPro 2.5, FoxPro 2.6, FoxPro 3.0 and FoxPro 5.0. They all include DBase III's features as core specifications and add new data types or extend certain limits. See mReadDBstructure from a DBF File for more details. Note Years ago, DBF files were convenient given that they contained less variants than TEXT files. However, since the introduction of Windows and the popularization of DBF to other Operating Systems, DBF files contain many categories and have become difficult to manage. V12-DBE's preferred file importing format is Text.
In summary, the exact structure and limitations of your DBF files largely depend on how your database management system deals with them.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Database Descriptors
Following is the format of text (and literal) database descriptors required by both the V12-DBE Tool and the mReadDBstructure method. It is used to build a database structure from scratch. If you build your V12 databases from other databases (e.g., MS Access, MS Excel, etc.), you can directly skip to Scripting the Database Creation. The desired V12-DBE database structure is stored in a text file (or Director member) called the database descriptor in the following format.
[TABLE] NameOfTable [FIELDS] FieldName1 FieldType1 IndexType1 FieldName2 FieldType2 IndexType2 FieldName3 FieldType3 BufferSize3 IndexType3 etc. [END]
The [TABLE] tag is be followed by one parameter: the name of the table. This is an identifier (see Defining Identifiers). The [FIELDS] tag is followed by as many lines as you need to define fields in the above defined table. The syntax of each line is as follows (see Database Basics for a thorough explanation of these concepts):
FieldName: the name given to the field to be created. This is an identifier
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
FieldType: string , integer, float, date, media or a custom string type (see Field Types), BufferSize: the amount of RAM to allocate for the internal management of the field's content. This parameter is relevant only for fields of type string and media. If omitted, fields of type string are created with a default buffer size of 255 characters and fields of type media are created with a default buffer size of 64K. See Field Buffer Size in Step 2: Preparing the Data. IndexType: the word "indexed" if the field must be indexed, or the word
"full-indexed" if the field must be full-indexed, or nothing if no indexing is required. If you need to both index and full-index a field, see Defining Both an Index and a Full-index on a Field. If you try to store a text longer than the size of the buffer allocated for a field type string, V12-DBE signals a warning and stores the truncated text into the field. Media that are larger than the maximum buffer size of a fields are not stored at all.
Note:
In each line of the descriptor file, tokens (i.e. field name, index name, value, etc.) must be separated by one or multiple Tabs and/or space characters. Note: A convenient way to build a descriptor file for a database containing a large number of tables, fields or indexes is to type it in a spreadsheet thus taking advantage of advanced editing functions. The result can then be saved to a TABdelimited file or Copy/Pasted to a Director field for processing by mReadDBStructure.
Example:
[TABLE] Recipes [FIELDS] NameOfRecipe string indexed Calories integer indexed CookingTime integer TextOfRecipe string 5000 full-indexed Photo media 300000 [END]
Note:
A valid database needs exactly one table, at least one field and at least one index.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
"indexed" or "full-indexed", you would need to set it to "indexed" and define the fullindex separately under an additional tag named [FULL-INDEXES]. The [FULL-INDEXES] tag must follow the [FIELDS] section and must be followed by a list of fields to be full-indexed, one per line. Example:
[TABLE] Recipes [FIELDS] NameOfRecipe string indexed Calories integer indexed CookingTime integer TextOfRecipe string 5000 indexed Photo media 300000 [FULL-INDEXES] TextOfRecipe [END]
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
[END]
where:
Indx1 is the name of the compound index UniqueOrDup is either "unique" or "duplicate", depending upon whether or not you allow duplicate entries for that index FieldName is the name of a field defined under the [FIELDS] tag AscOrDesc is "ascending" if you want that field sorted low-to-high, or
"descending" otherwise.
Up to ten FieldName AscOrDesc couples can be defined for a single compound index.
The comment opening tag for database descriptors must be followed by a blank character such as a space, tab or CARRIAGE_RETURN. Likewise, a comment closing tag must be preceded by a blank character. Thus,
(*invalid comment: will generate an error*)
is valid.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Instead of filling out the Database Descriptor field manually in the V12-DBE Tool, you can edit it in a text file and load that text file to the Tool's Database Descriptor field. You can also directly read the structure of a DBF file, or of another V12 database into the Tool's Database Descriptor field. For more information, see the V12-DBE Tool's User Manual.
where
FileName is the full pathname of the V12 database to create Password is the password to protect FileName InputType is one of "Text", "Literal", "DBF", "V12", "FoxPro", "Access",
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
other params are one or more parameters depending on the selected InputType.
See CheckV12Error in Errors and Defensive Programming for a definition of the CheckV12Error() handler used throughout this section.
an Existing Database.
Password: the password is required if you wish to protect your database against tampering and/or data theft. You can lock the database with a password, but make sure to record it in a safe place. If you forget it, you will not be able to open your database again.
Example:
set gDB = New(Xtra "V12dbe", "Catalog.V12", "Create", "top secret")
Note
For a number of reasons, the creation of an Xtra instance can fail (insufficient memory, invalid file path, etc.) Always make sure that your database instance is valid by checking V12Error (see Errors and Defensive Programming) or ObjectP (see Checking if New Was Successful in Using Xtras) before pursuing the database creation process.
a database descriptor as defined in Database Descriptors above. Such as descriptor is supplied either as a text file or as a literal (i.e. a Director field or variable),
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
a DBF file (DBase) which serves as a table template, a V12 database which serves as a database template, a directory containing one or more MS FoxPro files which serve collectively as a database template (Windows-32 only, requires the FoxPro ODBC driver), a MS Access database which serves as a database template (Windows-32 only, requires the Access ODBC driver), a MS Excel workbook which serves as a database template (Windows-32 only, requires the Excel ODBC driver), a MS SQL Server data source which serves as a database template (Windows-32 only, requires the MS SQL Server ODBC driver).
It is always a good practice to check the value returned by V12Error() or V12Status() after calling mReadDBstructure (see Errors and Defensive Programming) to find out if an error occurred. You may also call mDumpStructure right after calling mReadDBstructure to check the actual database structure V12DBE will build once mBuild is called. Database structure translation rules from the above ODBC-compliant databases to V12 Databases vary according to the specific ODBC driver installed on your computer.
Assuming that the name of the database descriptor's filename is "Def.txt", the following Lingo code creates a new V12-DBE database file named "Catalog.V12" and structures it as described in "Def.txt".
on CreateDatabase set gDB = New(Xtra "V12dbe", the pathname&"Catalog.V12", "create", "top secret") CheckV12Error() mReadDBStructure(gDB, "TEXT", the pathname & "Def.txt") CheckV12Error() mBuild(gDB) CheckV12Error() set gDB=0 end CreateDatabase
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
For example, assume that the Director member of type Field and named "descriptor" contains a database descriptor, the following example creates a V12-DBE database compliant to that description.
on CreateDatabase set gDB = New(Xtra "V12dbe", the pathname&"Catalog.V12", "create", "top secret") CheckV12Error() mReadDBStructure(gDB, "LITERAL", field "Descriptor") CheckV12Error() mBuild(gDB) CheckV12Error() set gDB=0 end CreateDatabase
For a DBF file to be used as a complete and valid V12-DBE table descriptor, at least one index must be defined. If that index is defined by an IDX or NDX file located in the same folder as the DBF file, mReadDBstructure detects its presence and automatically defines an index for that field in the current table. Tip V12-DBE does not check the validity of that index, therefore you can fool it to create an index for a field named "MyField" by creating an empty file named "MyField.IDX" in the same folder as your DBF file.
The following rules apply to the translation of DBF file structures: DBF field type Character Integer Numeric with no digit after fixed point Numeric with one or more digits after fixed point Float Double Currency Translated to V12 field type String Integer Integer Notes Buffer size = size of field in DBF file
Float Float Float Float On Windows 3.1 and Mac68K, acceptable values are in the range -2k to 2k-1, where k = 31
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
minus the number of decimal places. Date DateTime Date Date Data cannot be converted from fields of type DateTime. Only the default date (1900/01/01) is imported. FALSE values are translated to 0s, TRUE values to 1s and undefined values (represented by "?" in the DBF file) to -1s Buffer size = 32K
Memo fields are those typically used to Memo fields can also store binary data imported in V12-DBE databases. When contains Memo fields, the corresponding by V12-DBE.
store text longer than 255 characters. of arbitrary formats: those cannot be importing data from a DBF file that DBT files are automatically processed
The following example uses the file VIDEO.DBF as a template to build a table named "video" in the V12-DBE database named "VideoStore.V12". The structure of the file VIDEO.DBF is as follows:
Field TITLE DESCRIPT RATING TYPE DATE_ARRIV AVAILABLE TIMES_RENT NUM_SOLD Type Character Memo Character Character Date Logical Numeric Numeric Width 30 10 4 10 8 1 5 5
Two index files named TITLE.IDX and TYPE.IDX are available in the same folder as VIDEO.DBF. The Lingo script is as follows:
on CreateDatabase set gDB = New(Xtra "V12dbe", the pathname&"VideoStore.V12", "create", "") CheckV12Error() mReadDBStructure(gDB, "DBF", the pathname & "Video.DBF") CheckV12Error() mBuild(gDB) CheckV12Error() put mDumpStructure(gDB) set gDB=0 end CreateDatabase
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
The resulting V12-DBE database can be verified immediately with mDumpStructure (see Viewing the Structure of a Database ). The following is a sample output from mDumpStructure:
[TABLE] Video [FIELDS] TITLE String 30 DESCRIPT String 30000 RATING String 4 TYPE String 10 DATE_ARRIV Date AVAILABLE Integer TIMES_RENT Integer NUM_SOLD Integer [INDEXES] TitleNdx duplicate TITLE ascending (* Default Index *) TypeNdx duplicate TYPE ascending [END]
mReadDBStructure reads the structure of a DBF file, not its content. To import the
The following example uses the database "Catalog.V12" as a template for a new database named "Specials.V12".
on CreateDatabase set gDB = New(Xtra "V12dbe", the pathname&"Specials.V12", "create", "MyNewPassword") CheckV12Error() mReadDBStructure(gDB, "V12", the pathname&"Catalog.V12", "top secret") CheckV12Error() mBuild(gDB) CheckV12Error() set gDB=0 end CreateDatabase
mReadDBStructure reads the structure of a V12-DBE file, not its content. To import
the content of a V12-DBE file, see Importing from V12-DBE and Adding Records to a Database.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
where DirectoryPath is the path to a directory not a file. Thus, it must necessarily end with a "\". The following rules apply to the translation of FoxPro databases to V12 databases: FoxPro field type Character Integer Numeric Float Double Currency Date DateTime Logical Memo General Character-Binary Memo-Binary Translated to V12 field type String Float Float Float Float Float Date Date Integer String String String String Buffer size = 32K Buffer size is the size of the field in the DBF file Buffer size is 32K Buffer size is 32K Data cannot be converted from fields of type DateTime. Only the default date (1900/01/01) is imported. Notes Buffer size is the size of the field in the DBF file
FoxPro indexes are translated to V12-DBE indexes with unique values. Example:
on CreateDatabase set gDB = New(Xtra "V12dbe", the pathname&"myDB.V12", "create", "secret") CheckV12Error() mReadDBStructure(gDB, "FoxPro", the pathname&"FoxDB\") CheckV12Error() mBuild(gDB) CheckV12Error() set gDB=0 end CreateDatabase
mReadDBStructure reads the structure of a FoxPro database, not its content. To import the content of a database, see Importing from MS FoxPro (Win-32 only).
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
where
FileName is the path to the *.MDB file, Username is a valid user name to access the MDB file, or EMPTY if the MDB file is not protected, Password is Username's matching password, or EMPTY if the MDB file is not protected.
The following rules apply to the translation of MS Access file structures to V12 databases: MS Access field type Text Number (byte) Number (integer) Number (long integer) Number (single) Number (double) Number (replication ID) Currency Date / Time Autonumber Yes/No OLE Object HyperLink Translated to V12 field type String Integer Integer Integer Float Float Ignored Integer Ignored Integer Integer Ignored String URL imported as text Notes Buffer size is same as Access field size
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Memo-Binary
Ignored
MS Access unique and duplicate indexes are properly converted to unique and duplicate V12-DBE indexes with ascending field values.
mReadDBStructure reads the structure of a MS Access database, not its content. To
import the content of a database, see Importing from MS Access (Win-32 only).
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Custom
Float
MS Excel cannot define indexes on its fields, when reading an Excel workbook, V12DBE automatically indexes the leftmost field of each worksheet. Syntax:
mReadDBStructure(gDB, "Excel", FileName)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Buffer size is same as MS SQL Server field size Buffer size is same as MS SQL Server field size
where DSN is the name of a valid User DSN, System DSN or File DSN (see Window's Control Panel)
Username is a valid user name to access the DSN, Password is Username's matching password.
mReadDBStructure reads the structure of a MS SQL Server data source, not its content. To import the content of the data source, see Importing from MS SQL (Win32 only).
mBuild optionally accepts a second parameter, "online", that makes the created file
compatible to the V12-DBE Online companion. In this case, two additional fields, named _uID and _timeStamp are created for V12-DBE Online to manage internally. Both fields are hidden and do not appear in mDumpStructure's result. Syntax:
mBuild(gDB, "online")
Note:
A valid database needs exactly one table, at least one field and at least one index.
Example:
mBuild(gDB) -- since mBuild does a lot of validations, checking for errors/warnings is HIGHLY recommended if V12Status() then Alert "mBuild failed with error code" & V12Error()
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Once the database file is built, the database instance remains valid and data can be immediately imported into the file. It is as if the database was opened in ReadWrite mode. Note: For mBuild to create a licensed database (that is, one that does not display a Demo dialog when opened), a V12-DBE license file must be present on your Mac or PC. Since the V12-DBE license file cannot be delivered to the end-user, mBuild cannot be used to create new databases at runtime. If your application requires to create new databases at runtime, usee mCloneDatabase (see Cloning a Database).
Example:
put mDumpStructure(gDB) into field "myDBstructure"
The above example places the structure of the database referred by gDB in the member named "myDBstructure".
(* Structure of file 'HardDisk:myDatabase.V12' created on Thu Apr 29 15:55:07 1999, last modified on Tue May 11 15:31:53 1999, file format version = V12,3.0.0,Multi-User *) [TABLE] Articles [FIELDS] name string 256 category string 256 price Float catalognumber Integer description string 600 [INDEXES] nameNdx duplicate name ascending (* Default index *) categoryNdx duplicate category ascending priceNdx duplicate price ascending cat#Ndx unique catalognumber ascending catNameNdx duplicate category ascending name descending [FULL-INDEXES] description [END]"
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note that the date/hour of the last modification mentioned in the header of the above output is provided by the Operating System. Therefore, it reflects the date/hour at which the V12 database was closed regardless of when the modification occurred. This output is fully compatible with the database descriptors discussed in Database Descriptors and thus, can be used as is with mReadDBstructure.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
is still supported in V12-DBE version 3.0. However, it will be phased out in future versions.
2. 3.
If the source data is in more than one file, you can successively import them by repeating the above steps. For more information, see the V12-DBE Tool's User Manual.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mImport is very flexible and can be adapted to a large number of situations. It can import data from: - a Text file - a literal value, such as a string, a Director member, etc. - a DBF file - a V12 database - a Lingo list or Lingo property list - a MS Access database through an ODBC driver (Win-32 only) - a FoxPro file through an ODBC driver (Win-32 only) - a MS Excel file through an ODBC driver (Win-32 only) - a MS SQL data source through an ODBC driver (Win-32 only)
Data type translation rules from the above ODBC-compliant databases to V12 Databases vary according to the specific ODBC driver installed on your computer. The general form of a table importing script is:
-- create a V12dbe instance set gDB = New(Xtra"V12dbe", database_filename, mode, password) CheckV12Error() -- create a V12table instance set gTable = New(Xtra "V12table", mGetRef(gDB), TableName) CheckV12Error() -- import data mImport(gTable, InputType, InputSource, other params) CheckV12Error() -- free the V12table and V12dbe instances set gTable = 0 set gDB = 0
As for any V12table method, valid instances of V12dbe and V12table must exist before the method is invoked. This is explained in details in Creating Instances.
mImport's syntax varies significantly according to the selected input source. This is explained in details in Importing Data with mImport below.
Setting Xtra instances to 0 when they are no longer needed is mandatory, as explained in Closing an Xtra, so to make sure that the imported data is secured on hard disk.
CheckV12Error is a generic error management handler explained in Errors and Defensive Programming.
Note
Previous versions of V12-DBE could import only Text and DBF files via mImportFile. mImportFile is still supported for backward compatibility reasons. It will be progressively phased out in future versions of V12-DBE.
where:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
where FileName is the pathname of the text file to import, and Options is an optional Lingo Property list containing the following properties:
#field_delimiter determines which character is used to delimit fields in the text file. The default character is TAB (ASCII #9). #record_delimiter determines which character is used to delimit records in the text file. The default character is RETURN (ASCII #13). If the Text file contains Carriage Returns (ASCII #13) followed by Line Feeds (ASCII #10) as records delimiters, Line Feeds are automatically ignored. #character_set is one of "Mac-Standard", "Windows-ANSI" or "MSDOS". It determines which character set the Text file is encoded in. Usually, Text files exported on MacOS are encoded in the Mac-Standard character set, and Text files exported on Windows are encoded in the Windows-ANSI character set. See Character Sets in Step 2: Preparing the Data. The default character set is the one defined by the CharacterSet property (see CharacterSet in Properties of Databases). #virtual_CR determines which character is used as a Virtual Carriage Return, and thus must be converted to ASCII #13 after importing (see Virtual Carriage Returns in Step 2: Preparing the Data). The default character is the one defined by the VirtualCR property, which is usually ASCII #11 (see VirtualCR in Properties of Databases). #text_qualifier determines which character is used to begin and end each
Text field. Those qualifiers delimit the field so to allow it to contain special characters, including those used as field and record delimiters. Text qualifiers
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
are removed after importing the file. See Text Qualifiers in Step 2: Preparing the Data. The default text qualifier is QUOTE For example, the following instruction imports the Text file "myTextData.txt" located in the same folder as the current movie into gTable with all the default options (field delimiter = TAB, records delimiter = RETURN, Character set = the current operating system's, virtual CR = ASCII #11, Text Qualifier = QUOTE).
mImport(gTable, "TEXT", the pathname & "myTextData.txt")
This second example imports the Text file "myFile.txt" which uses "%" as field delimiter and "\" as record delimiter.
mImport(gTable, "TEXT", the pathname & "myTextData.txt", [#field_delimiter:"%", #record_delimiter:"\"] )
and Options is a property list identical to the one used for importing Text files (see Importing from a TEXT File above). Following is an example of a Director field containing data to split into V12-DBE fields and records (assume the name of the field is "Discounts"): Level-1,Level-2,Level-3 12,14,16 45,58,72 33,56,68 224,301,451 The following instruction imports the above Director field to gTable:
mImportFile(gTable, "LITERAL", field "Discounts", ",", RETURN)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
where FileName is the pathname of the DBF file to import, and Options is an optional Lingo Property list containing the following property:
#character_set is one of "Mac-Standard", "Windows-ANSI" or "MSDOS". It determines which character set the DBF file is encoded in. Most systems automatically encode DBF file in the MS-DOS character set. See Character Sets in Step 2: Preparing the Data. The default character set the one defined by the CharacterSet property (see CharacterSet in Properties of Databases). It is normally "Windows-ANSI" on the Windows version of V12DBE and "Mac-Standard" on the Macintosh version of V12-DBE.
Note
DBF is an antiquated file format. It is always assumed to be encoded in the MS-DOS character set. When importing a DBF files, make sure to assign the right Character Set. See CharacterSet in Properties of Databases.
Example:
mImport(gTable, "DBF", the pathname&"Pier1-Import.DBF", [#character_set:"MS-DOS"])
If a field in the destination table has the same name as a field in the source DBF file, but is of a different type, mImport tries to typecast the data to match the destination field type. When importing data from a DBF file that contains Memo fields, the corresponding DBT files are automatically processed and imported by V12-DBE. See Dealing with Dates and mReadDBstructure from a DBF File for more details on DBF files and data importing rules.
where FileName is the pathname of the V12 database to import from, password is the password to unlock it and TableName is the name of the table to import. Example:
mImportFile(gTable, "V12", the pathname&"Catalog.V12", "top secret", "articles")
If two fields have the same name but are of different types when importing data from a V12-DBE database, mImport tries to typecast the data fields.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
where:
theList is a Lingo list of lists. The first element is a list containing the names of the V12 fields to which subsequent items must be imported, in the right order. If the first item of the list contains field names that are not present in the current V12 table, the corresponding data is ignored. thePropertyList is a Lingo list of property lists, where properties have the
same names as the V12 fields into which the corresponding data must be imported.
Importing XML to V12-DBE You can import an XML document to a V12 table using Macromedia's XML parser Xtra (delivered with Director 7). This is a two-step process: 1 Convert the XML document to a Lingo property list using the XML parser. Example (the XML string xmlString below is convert to xmlPropList)
parserObj = new (xtra "xmlparser") node = parseString(parserObj, xmlString) error = getError(parserObj) if voidP(error) then xmlPropList = makeList(parserObj) else alert "Sorry, there was an error"&&error end if
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
where
FileName is the path to the source *.MDB file, Username is a valid user name to access the MDB file, or EMPTY if the MDB file is not protected, Password is Username's matching password, or EMPTY if the MDB file is not protected. TableName is the name of the table to import.
Converting an MS Access database into a V12 database is a two-step process: First, create the V12 database (see mReadDBstructure from MS Access (Win-32 Only)). Then, import data to each of its tables with mImport, as explained above. Generally, MS Access databases are encoded in the Windows ANSI character set. Thus, you must make sure that the CharacterSet Property is properly set to "Windows-ANSI" before importing the data. ("Windows-ANSI" is the default setting for the CharacterSet property. See CharacterSet in Properties of Databases).
where FileName is the path to the source *.DBF file. Always make sure to set V12DBE's CharacterSet property to the encoding that matches your DBF file's (see CharacterSet in Properties of Databases). Example:
mImport(gTable, "Excel", the pahtname&"Results.XLS", TableName)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Converting a FoxPro database into a V12 database is a two-step process: First, create the V12 database (see mReadDBstructure from FoxPro (Win-32 Only)). Then, import data to each of its tables with mImport, as explained above.
where:
FileName is the path to the source *.XLS file. It is assumed to be encoded in the Windows ANSI character set (default encoding on Windows). TableName is the name of the table to import.
Example:
mImport(gTable, "Excel", the pahtname&"Results.XLS")
Protected MS Excel workbooks cannot be imported Converting a MS Excel workbook into a V12 database is a two-step process: First, create the V12 database (see Importing from MS Excel (Win-32 only)). Then, import data to each of its tables with mImport, as explained above.
where:
DSN is a valid Data Source Name. Username is a valid user name to access the SQL Server. Password is Username's matching password. TableName is the name of the table to import.
Example:
mImport(gTable, "SQLserver", "InventoryDSN", "Admin", "XBF48", "Products")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Converting an MS SQL Server data source into a V12 database is a two-step process: First, create the V12 database (see mReadDBstructure from MS SQL Server (Win-32 Only)). Then, import data to each of its tables with mImport, as explained above.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
-- loop on each record and import the matching image repeat with i = 1 to mSelectCount(gTable) -- record i becomes the current record mGo(gTable, i) -- get the photo's filename and import it in a member set catNbr = mGetField(gTable, "catalogNumber") set the filename of member "DummyMember" to (the pathname&catNbr) -- assign the photo to the appropriate V12-DBE field mEditRecord(gTable) mSetMedia(gTable, "photo", member "DummyMember") mUpdateRecord(gTable) end repeat set gTable = 0 -- close the table instance set gDB = 0 -- close the database instance
The mAddRecord, mSetField, mGetField and mUpdateRecord methods are explained in greater detail Using a V12-DBE Database.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Using Lingo
As for any V12-DBE method, a valid V12dbe or V12table Xtra instance (depending on which Xtra the method belongs to) must exist before the method is invoked. Generally, you create instances of V12dbe and V12table on StartMovie, store their references in global variables and use those instances throughout your project. Likewise, on StopMovie, you set those global variables to 0 thus disposing of the Xtra instances and closing the V12 database file. The creation of such Xtra instances is often referred to as Opening a Database and Opening a Table. Disposing the Xtra instances is often referred to as Closing the Database and Closing the Table instances.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Opening a database means creating a V12dbe Xtra instance with the following parameters:
database_Filename: the name if the database file. This is usually a filename preceded by the lingo function the pathname & to indicate that the file is located in the same folder as the current movie (see Dealing with Pathnames in Using Xtras). mode: the mode in which the Xtra instance is opened. To allow for modifications to the database, open it in "Shared ReadWrite" or "ReadWrite" mode. If you open your database in "Shared ReadWrite" mode, up to 128 users can access your database simultaneously (see Appendix 4: Multi-user Access). If you open it in "ReadWrite" mode, only one user at a time can access your database. If you do not allow modifications to your database, open it in "ReadOnly" mode. password: the password. If you do not use the correct password, the database cannot be opened.
Example:
set gDB = New(Xtra "V12dbe", the pathname & "Catalog.V12", "ReadWrite", "top secret")
Always make sure that the New method succeeded by checking the validity of the returned reference with ObjectP. Example:
set gDB = New(Xtra"V12dbe", the pathname & "Catalog.V12", "ReadWrite", "top secret") if NOT (ObjectP(gDB)) then alert "New V12dbe failed"
Opening a Table
Records belong to tables. Creating new records, reading the contents of records, and searching and sorting records are operations that are performed on tables. Prior to performing any of these operations, you must create a table Xtra instance Syntax:
set gTable = New(Xtra "V12table", mGetRef(gDB), TableName)
To create a table Xtra instance, use the New method with the following parameters:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
gDB: the database Xtra instance to which the current table belongs TableName: the name of the table to open
Example:
set gTable = New(Xtra "V12table", mGetRef(gDB), "Articles")
mGetRef is a standard Xtra method that returns the exact reference of an Xtra
instance. Always make sure that the New method succeeded by checking the validity of the returned reference with ObjectP. Example:
set gTable = New(Xtra "V12table", mGetRef(gDB), "Articles") if NOT (ObjectP(gTable)) then alert "New V12table failed"
Closing a Table
To close a table, set the variable that refers to it to 0. Example:
set gTable = 0
Closing a Database
To close a V12 database, set the variable that refers to it to 0. Example:
set gDB = 0
Always make sure to dispose of all V12table instances before you dispose of the V12dbe instance that contains them. Following is a complete example of a script that would run on StopMovie:
on StopMovie global gDB, gTable set gTable = 0 set gDB = 0 end StopMovie
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
selection's sorting order would be defined by the index chosen by V12-DBE for its last search. The field that determines the selection's sorting order is called the master field.
Selection at startup
When a table is first opened, its selection is the entire content of that table sorted by the field that is indexed by the default index. The first record of that selection which is also the first record of the table is the current record. The default index is the first index that was defined for the table in the database descriptor. You can use mDumpStructure to verify which of the table's index is the default index (see Viewing the Structure of a Database). You never need to explicitly manage indexes in V12-DBE. The best index is always chosen by V12-DBE to perform a search. See Appendix 12: Optimization Using Indexes for advanced index management.
To force a specific sort order, call mOrderBy before calling mSelectAll Example:
mOrderBy(gTable, "price", "ascending") mSelectAll(gTable)
This example sets the selection to the whole table as referred by gTable, in ascending order of prices (least to most expensive). The field "price" must be indexed for mSelectAll to work efficiently. Otherwise, it would be very slow.
Browsing a Selection
Browsing a selection means changing the position of the current record. The following methods enable you to change the current record in a selection (to set the current record to various values related to a given selection).
mGetPosition
mGetPosition checks the position of the current record in a table and returns an
integer between one and the total number of records in the selection. Example:
set currRec = mGetPosition(gTable) -- returns the current record's position in the Message Window put "the current record is:" & currRec
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mGoNext
mGoNext sets the current record to the record following the current record.
Example:
mGoNext(gTable)
Suppose that the current record is the tenth item in the selection. After calling mGoNext, the current record becomes the eleventh. If the selection contains only ten records, the current record does not change and a warning is reported by V12-DBE (see Errors and Defensive Programming).
mGoPrevious
mGoPrevious sets the current record to the record preceding the current record.
Example:
mGoPrevious(gTable)
Suppose that the current record is the tenth item in the selection. Upon calling mGoPrevious, the current record becomes the ninth. If the current record is the first record of the selection, upon calling mGoPrevious the current record does not change and a warning is reported by V12-DBE (see Errors and Defensive Programming).
mGoFirst
mGoFirst sets the current record to the first record of the selection.
Example:
mGoFirst(gTable)
mGoLast sets the current record to the last record of the selection.
Example:
mGoLast(gTable)
mGo
mGo takes one integer parameter (call it n) and sets the current record to the n
th
item of
This example sets the current record to the eleventh record of the selection. If no such record exists, mGo signals a warning.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mFind
mFind sets the current record to one, in the selection, whose Master Field equals or
starts with the keyword provided in parameter (see definition of Mater Field in Selection and Current Record).
mFind is a great complement to mGo which can set the current record only based on its
where Keyword is the value to look for in the Master Field. If the Master Field is of type String, the matching record's content must start with Keyword. If it is of type Integer, Float or Date, it must equal Keyword Use the first form (with the "First" parameter), if you want the new current record to be the first one of the selection that matches Keyword Use the second form (with the "Next" parameter) if you want it to be the next record in the selection according to the present current record. Use the third form ("Previous") if you want it to be the previous record in the selection according to the present current record. If, for example, you run the following script
mSetCriteria(gT, "Age", ">", 30) mOrderBy(gT, "LastName") mSelect(gT)
The selection's Master Field is "LastName". Thus, a call to mFind would automatically look for values in this field. For example:
mFind(gT, mFind(gT, mFind(gT, mFind(gT, mFind(gT, mFind(gT, "First", "Kar") -- current rec becomes Mona Karp's "Next") -- current rec becomes Joe Karp's "Next") -- current rec becomes Richard Karp's "Next") -- current rec becomes Eric Kartman's "Next") -- current rec remains Eric Kartman's "Previous") -- current rec becomes Richard Karp's
mFind can be used to quickly locate one occurrence of a keyword in a selection where many duplicate values exist, as opposed to mSetCriteria and mSelect which find
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note
Because mFind uses the selection's Master Field, it is advised that you call mOrderBy with the appropriate field before calling mSelect and mFind. (see Searching Data with mSetCriteria). If you don't call mOrderBy, mFind sets the current record based on the Master Field chosen by default by V12-DBE, which is either the one indexed by the default index (if the table was just opened), or the one indexed by the best index chosen by V12-DBE during the last search.
Example:
set cost = mGetField(gTable, "price")
This example stores the content of the price field from the current record in the variable cost. You do not need to specify the type of field you are reading. The Lingo variable is automatically set to the appropriate type after a successful call to mGetField (see Typecasting in Database Basics). Example:
set cost = mGetField(gTable, "price", "9,999.99")
This example retrieves the formatted content of the price field to the cost variable. The formatting is according to the pattern "9,999.99". That is, if the field price contains the value 1245.5, the string "1,245.50" is returned by mGetField. Note that the result of a formatted value is always a string. Data formatting applies to mGetField the same way it does to mDataFormat. If two distinct formatting patterns are applied to a field with the mGetField option and mDataFormat, the mGetField option overrides mDataFormat. See Data Formatting for a complete explanation on formatting patterns. Note
mGetField retrieves only unformatted text. If you store
styled text to a V12 record, you can retrieve the text without the styles with mGetField and the styled text with mGetMedia. See Managing Styled Text.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
a string where fields are delimited by TABs and records by CARRIAGE_RETURNs (the default delimiters), or by any other custom delimiters you specify. a Lingo list of lists, where each sub-list represents a record and each item of each sub-list is the data contained in the corresponding field a Lingo list of property lists, where each sub-list represents a record and each item is a property/value pair: the property is the name of the field and the value is the data contained in it.
mGetSelection is powerful and flexible. It's behavior depends on the syntax used to call it. The syntax for mGetSelection to return a result of type String is:
mGetSelection(gTable ["Literal" [, From [, #recs [, FieldDelimiter [, RecordDelimiter [, FieldNames ]* ]]]]])
where:
gTable is the instance of the table from which records must be retrieved
(mandatory parameter),
From is the number of the first record to retrieve data from. It is optional. The default value is 1. #recs is the number of records to retrieve starting from record number From. It is optional. The default value is the number of records between From and the end of the selection plus 1 (convenient to retrieve all the records of a selection starting from record number From). FieldDelimiter is the character to use as the field delimiter. It is optional. The default field delimiter is a TAB. RecordDelimiter is the character to use as the record delimiter. It is optional. The default field delimiter is a CARRIAGE_RETURN. FieldNames are the names of the fields to retrieve, in the specified order. If the field names are omitted, mGetSelection returns the contents of all the fields of gTable, in their order of creation. Fields of type Media are ignored by mGetSelection.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Besides gTable, all other parameters are optional. However, if a parameter is present, all its preceding ones must also be present. For example, if #recs is present, result_format and From must also be present.
mGetField requires that you set the current record to the record you need to retrieve data from. mGetSelection does not.
The examples below show various ways of using mGetSelection. All examples assume that the table gTable contains 3 fields ("name", "price" and "number", declared in that order when creating the table), and that the selection contains 6 records. Reading the Entire Selection This example retrieves the entire content of each record of the selection with TABs as field delimiters and CARRIAGE_RETURNs (CRs) as record delimiters. Fields are sorted in their order of creation. The records' sort order is the one defined by the selection.
set x = mGetSelection(gTable)
Reading a Range of Records in a String variable This example retrieves the content of 3 successive records in the selection starting with record #2, with TABs as field delimiters and CARRIAGE_RETURNs (CRs) as record delimiters..
set x = mGetSelection(gTable, "LITERAL", 2, 3)
Reading a Range of Records in a Lingo List This is identical to the previous example, except that the result is returned in a Lingo list:
set x = mGetSelection(gTable, "LIST", 2, 3)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Reading a Range of Records in a Property List Same as the two previous examples, except that the result is returned in a Lingo property list:
set x = mGetSelection(gTable, "PropertyList", 2, 3)
Reading the Entire Content of the Current Record This example retrieves the entire content of the current record in a single call to V12DBE.
set x = mGetSelection(gTable, "LITERAL", mGetPosition(gTable), 1)
and
[ [#name:"Batteries", #price:9.20, #number:6780] ]
Reading a Record without Setting it as the Current Record This example retrieves the content of record #4 without setting it as the current record.
set x = mGetSelection(gTable, "LITERAL", 4, 1)
and
[ [#name:"Pencils", #price:5.55, #number:6251] ]
Reading the Entire Selection with Special Delimiters This example retrieves the entire content of each record of the selection with commas (",") as field delimiters and slashes ("/") as record delimiters.
set x = mGetSelection(gTable, "LITERAL", 1, mSelectCount(gTable), "," , "/" )
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Reading Selected Fields in a Selection This example retrieves the content of a single field ("name") for all the records of the selection. Note that the TAB parameter is unused in the result, but it should nonetheless be present.
set x = mGetSelection(gTable, "LITERAL", 1, mSelectCount(gTable), TAB , RETURN, "name" )
Note
Reading Records with a Determined Order of Fields This example retrieves the content of all the records of the selection with TABs as field delimiters and CARRIAGE_RETURNs (CRs) as record delimiters, with fields ordered in the sequence "number", "name", "price".
set x = mGetSelection(gTable, "LITERAL", 1, mSelectCount(gTable), TAB, RETURN, "number", "name", "price")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Although, this latter request would not be of much interest because property lists are parsed by property names, not item positions.
Syntax:
set a = mGetUnique(gTable, "literal") set b = mGetUnique(gTable, "list")
mGetUnique is very convenient to populate a user interface element (such as scrolling list or pull-down menu) with search values that are relevant only for a specific database and context.
Example: In a clothing catalog, you want to display only the available colors for a specific category and size of product (e.g., T-shirt and XXL). You run the following script:
mSetCriteria(gTable, "category", "=", "T-shirt") mSetCriteria(gTable, "and", "size", "=", "XXL") mOrderBy(gTable, "color") mSelect(gTable) put mGetUnique(gTable, "literal") into field "ScrollList"
This script retrieves unique values of the "color" field (which is the Master Field) to the field "ScrollList". Assuming that your selection contains 30 records (10 with Color = "Red", 10 with Color = "Green" and 10 with Color = "Blue"), the above script puts the string
Blue Green Red
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note
Because it uses the selection's Master Field, it is recommended that you call mOrderBy with the appropriate field before calling mSelect and mGetUnique. If you don't call mOrderBy, mGetUnique returns unique values from the Master Field chosen by default by V12DBE, which is either the one indexed by the default index (if the table was just opened), or the one indexed by the best index chosen by V12-DBE for the last selection. See Selection and Current Record above.
Data Formatting
mDataFormat assigns a display pattern to a field so that all data read from that field are formatted according to that pattern. All V12-DBE methods that read data from a formatted field are affected. These include mGetField and mGetSelection.
Syntax:
mDataFormat(gTable, FieldName, Pattern)
The following example forces all data retrieved from the field price to be formatted with 3 integral digits and 2 decimal places. Example:
mDataFormat(gTable, "price", "999.99")
mDataFormat can be applied to fields of type float, integer and date. Media and string fields cannot be formatted.
To reset the formatting of a pattern to its original value, call mDataFormat with an empty string. Example:
mDataFormat(gTable, "price", "")
Formatting Integers and floats Valid patterns for fields of type integer and float contain the following:
9 designates a digit at that position (possibly 0), # designates a digit or a space at that position, . (period) designates the decimal point,
The following example forces the output of the field ratio to 2 integral digits, 2 decimal places and a trailing "%" sign:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
If the value in field ratio is 34.567, the displayed string is "34.57%". The pattern "###9999" forces the output of an integer field to be formatted within no less than four digits and with three leading spaces if necessary. Thus:
4 123 314159 3141592 31415926 is is is is is formatted formatted formatted formatted formatted as as as as as " 0004" " 0123" " 314159" "3141592" "#######"
The last formatting in the above example fails because an eight-digit integer does not fit in a seven-digit pattern. The pattern "(999) 999-9999" is convenient for formatting phone numbers stored as integers. For example:
mDataFormat(gTable, "phone", "(999) 999-9999") put mGetField(gTable, "phone") -- returns something formatted as "(514) 871-1333"
Formatting Dates Valid patterns for fields of type date are combinations of:
D for days, M for months, Y for years,
The following example formats the date in the "Year-Month-Day" numerical format:
mDataFormat(gTable, "TheDate", "YY-MM-DD") put mGetField(gTable, "TheDate")
Assume the content of field TheDate for the current record is Jan 5th, 95 - the returned string is "95-01-05".
Ds, Ms and Ys can be combined in the following way:
To format Days as 1-31 Days as 01-31 Weekdays as Sun-Sat Weekdays as Sunday-Saturday Months as 1-12 Months as 01-12 Months as Jan-Dec Months as January-December Years as 00-99 Years as 1900-9999 Use this sequence D DD DDD DDDD M MM MMM MMMM Y or YY YYY or YYYY
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Examples:
The pattern Formats 5 January 1995 as D 5 DDDD Thursday MM 01 DD-MM 05-01 MMM DD, YY Jan 05, 95 On D MMMM, YYYY On 5 January, 1995 'Weekday='DDDD; 'Month=' MMMM Weekday=Thursday; Month=January
In this last example, apostrophes around 'Weekday' and 'Month' are mandatory, otherwise the "d" in Weekday and the "m" in Month would interfere with the pattern itself. To specify real apostrophes within date patterns, use two consecutive apostrophes. When a table is first opened, the default format of all its Date fields is set to "YYYY/MM/DD". By default, the names for the months in V12-DBE are (MMMM)
January, February, March, April, May, June, July, August, September, October, November, December
All of these names can be replaced by custom names through the properties of the database (see Properties of Databases). Note: If a formatting pattern is assigned to a field, all values retrieved from that field become strings (see Typecasting in Database Basics).
Syntax:
mGetMedia(gTable, fieldName, DirMember)
Example:
mGetMedia(gTable, "photo", member "PhotoMember")
This example stores the content of the field "photo" from the current record into the member named "PhotoMember" in Director's internal castlib. If more than one castlib is used in a project, mGetMedia can also retrieve media to any castlib through the following syntax:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Example:
mGetMedia(gTable, "photo", member 28 of castlib "album")
If mUpdateRecord is not called, the record created with mAddRecord is not saved to the database. After calling mUpdateRecord, the record is created and kept in a cache: it is not immediately written to disk. Thus, if the computer crashes or a power failure occurs, the database file on disk may become corrupt. To secure the newly added records onto the hard disk, close the database and open it again (see Opening and Closing Databases and Tables). New records are always added to the end of the selection regardless of the criteria used to form the selection. Note Only mSetField and mSetMedia can be called after mAddRecord and before mUpdateRecord. Calling any other method aborts the new record adding process and sets the current record to the previous current record. Thus, if you started to add a record and wish to abort the operation, simply call mGetField instead of calling mUpdateRecord.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Like mAddRecord, every call to mEditRecord must be balanced with a call to mUpdateRecord. Calls to mSetField will result in an error if not preceded by mEditRecord. If an error occurs when updating a record (e.g. Duplicate Key error in a given field), none of the preceding calls to mSetField are taken into consideration. When writing to a field whose type is not the same as the supplied parameter, V12DBE tries to cast the parameter to the appropriate type and to interpret it as accurately as possible (see Typecasting). Example
mSetField(gTable, "price", "3.14") - stores the value 3.14 mSetField(gTable, "price", "xyz") - stores the value 0.00 mSetField(gTable, "name", 1234) - stores the string "1234"
Note:
Updating the content of a field that has a full-index may take more time than equivalent fields without full-indexes.
Storing the current date in Raw format may be difficult as Lingo's the Date function returns the current date in the Control Panel settings of the computer it is running on. In this case, use mGetProperty(gDB, "CurrentDate") to retrieve the current date in Raw format (see CurrentDate in Properties of Databases).
The following example copies the content of member "Yeti" of castlib "photo_album" to the field photo:
mEditRecord(gTable) mSetMedia(gTable, "photo", member "Yeti" of Castlib "photo_album")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mUpdateRecord(gTable)
Note:
Only mSetField and mSetMedia can be called after mEditRecord and before mUpdateRecord. Calling any other method aborts the new record adding process and sets the current record to the previous current record. Thus, if you started editing a record and wish to abort the operation, simply call mGetField instead of calling mUpdateRecord.
Deleting a Record
Call mDeleteRecord to delete the current record. Syntax:
mDeleteRecord(gTable_instance)
Example:
mDeleteRecord(gTable)
After calling mDeleteRecord, the record which follows the record being deleted becomes the new current record. If no record follows the deleted record, the preceding record becomes the new current record. If no record precedes the deleted record, the selection is then empty and the current record is not defined.
After mSelDelete has been completed, the selection is empty and the current record is undefined. Note: Use this method with caution. There is no way to undelete records in V12-DBE. As a general rule, avoid giving direct access of this method to the end-user through your user interface.
Data Binding
Throughout this section, the term field is used to designate a V12-DBE field, and member to designate a Director member.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mBindField establishes a live link between a field and a member. Once bound, the member automatically displays and updates the content of its associated field, for the current record.
Syntax:
mBindField(table_instance, V12FieldName, DirMember)
Example:
mBindField(gTable, "price", member "thePrice") mBindField(gTable, "age", member "AgeOfStudent" of Castlib "External-two")
mUnBindField performs the opposite function - it breaks the link between a member
Example:
mUnBindField(gTable, member "thePrice")
mBindField spares you multiple calls to mGetField and mSetField every time the current record changes. It performs a complete read/write binding between the member and its associated field. Every time the current record changes, V12-DBE updates the field with the Director member content, goes to the new current record and then refreshes the Director member with the new field's content.
Data displayed in the bound members comply to the formatting pattern supplied to mDataFormat, if such a pattern is specified. At any given time, a maximum of one field can be bound to a Director member. However, a single field can be bound to several members and they can all display the bound field's content from the current record. This may lead to ambiguous results if two or more of these members are edited and need to be saved in the associated field. When updating such data, V12-DBE always gives precedence to the last bound member. If a V12-DBE field of type string is bound to a Director member of another type, the type of the Director field is forced to the type imposed by the binding (that is, string): its contents will be replaced. Fields of all types can be bound to Director members, including fields of type Media. If a V12-DBE field is bound to a member such as a check box or radio button, the member is checked if the field contains a non-zero value. It is not necessary to call mUnBindField before you free a table (setting its instance to zero). Once free, all bindings pertaining to the fields of a table are automatically revoked.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Binding Types
V12-DBE offers the possibility of controlling when the binding features are applied, (i.e. refreshing the screen and updating the database information). It is defined as either Full or Safe binding, and set with the bindingType parameter. When the bindingType is not specified, it is automatically set to "Fullbinding".
Full Binding
For projects that usually require simple browsing and viewing of information, the binding is a Full binding. This means that information is displayed and updated automatically to and from the V12 database.
mBindField(gTable, V12FieldName, DirMember, "FullBinding")
The
"SafeBinding"
parameter
instructs
V12-DBE
to
wait
for
calls
to
which forces the retrieval of content from V12-DBE and refreshes the display for the bound member, and for all bound members simultaneously. If you wish to refresh only selected bound fields, use:
mRefreshBoundFields(gTable, "f1", "f2", "f3")
which refreshes the members associated with fields f1, f2 and f3 only, as long as they are already bound by mBindField. Explicitly triggering member fieldupdates uses mUpdateBoundFields in much the same way as. mUpdateBoundFields forces the writing of Director members content into their bound V12-DBE fields.
mUpdateBoundFields(gTable)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mGenerateMembers
mGenerateMembers is usually used immediately after the creation of a database to generate members that correspond to the created fields.
Syntax:
mGenerateMembers(table_instance, fromMember)
This instruction creates as many members as there are fields in table_instance, starting the creation process from member fromMember. The members are of types compatible with the V12-DBE field they were generated from. Fields of type String, Integer, Float and Date generate members of type "field" in Director. Fields of type Media generate members of type Bitmap. That would change to Sound, Palette, or any other member type depending on the exact content retrieved by mGetMedia. For example, assume gTable refers to a table named articles containing the fields: ItemName of type String, Description of type String, Price of type Float, Catalog number of type Integer and Photo of type Media:
mGenerateMembers(gTable, member 22)
creates five members in the internal castlib starting from member 22. If all members 22 - 26 are empty upon calling mGenerateMembers, members 22, 23, 24, 25 and 26 are created. If any of the members 22 - 26 are not empty upon calling mGenerateMembers, the members are skipped. In the above example, suppose that members 24 and 26 already existed, mGenerateMembers would have then created members 22, 23, 25, 27 and 28.
mGenerateMembers can also generate members in any castlib other than the default Director "internal" castlib as follows:
mGenerateMembers(gTable, member "bird" of castlib "album")
The newly created members are named after the table from which they were generated, followed by the V12-DBE field name they represent, with a comma in-between. In the above example, the newly created members are named "Articles,ItemName", "Articles,Description", "Articles,Price", "Articles,Catalog number" and "Articles,Photo". This naming scheme enables you to get each piece of information as follows: for a given auto-generated member (say member 25), item 1 of the name of member 25 returns the name of the table from which it is generated and item 2 of the name of member 25 returns the name of the field from which it is generated.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mAutoBinding
mAutoBinding tries to bind V12-DBE fields to Director members automatically based on the naming convention described above (e.g., "TableName,FieldName").
Syntax:
mAutoBinding(table_instance, castLib)
This operation tries to bind each field of table_instance to a member of castLib. If more than one member is eligible to be bound, the one with the smallest number is bound and the others are ignored. For example, if gTable refers to a table named articles containing the fields: ItemName, Description, Price, Catalog number and Photo, and if the Director movie's internal cast contains members named "Articles,ItemName", "Articles,Description", "Articles,Price", "Articles,ItemName" and "Articles,Photo" (possibly obtained by calling mGenerateMembers):
mAutoBinding(gTable, "internal")
As does mBindField, mAutoBinding accepts the parameter SafeBinding to establish a binding link between fields and members where data updating and refreshing operations must be explicitly triggered with mUpdateBoundFields and mRefreshBoundFields. Syntax:
mAutoBinding(gTable, "Cast", "SafeBinding")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
order to be selected.
The following example selects all items that are cheaper that $12.
mSetCriteria(gTable, "price", "<", 12) mSelect(gTable)
Upon completion of mSelect, the resulting selection contains the set of records that satisfy the defined criteria. In the above example, all records that contain a price field with a value that is strictly smaller than 12 are selected. In addition, the selection is sorted with an increasing order of prices given that a search with a defined ascending index was performed on that field. The current record is the first record of that selection. In our example, it is the least expensive item. If you want the selection sorted in an order other than the one proposed by mSelect, you can do so by calling mOrderBy right before calling mSelect. However, keep in mind that this may cost some additional processing time. Values provided to mSetCriteria need to be in the same type as FieldName. As discussed in Database Basics / Typecasting, V12-DBE tries to automatically typecast value to the proper type. Borderline conditions such as criteria containing extra spaces, carriage returns or other unwanted characters must be avoided. Example:
mSetCriteria(gTable, "price", "<", "100")
is strictly equivalent to
mSetCriteria(gTable, "price", "<", 100.00)
Operations on fields of type Date require that Value be supplied in Raw format (see Step 2: Preparing the Data / Dealing with Dates). The following example locates all records where field theDate contains a date occurring before May 21st, 1997.
mSetCriteria(gTable, "theDate", "<", "1997/05/21")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
The above example selects all hats in gTable and returns a selection sorted by a descending order of prices (most expensive to least expensive). If mOrderBy is not called before calling mSelect, the sort order of the selection depends on the index used to perform the search. That index is automatically chosen by V12-DBE to optimize the search time. See Appendix 12: Optimization Using Indexes.
Operators
The following is a list of valid operators and their meanings. Although comparisons of integers, floats and dates are straightforward, comparing strings and custom string types depends on how those comparison rules are defined (see Appendix 16: String and Custom String Types). Media fields cannot be compared.
Equal (=)
The "=" operator is used to locate data that exactly match the specified value. Example:
mSetCriteria(gTable, "price", "=", 3.14)
specifies a search for items named "hat". Items named "hats" or "hatchet" will not be selected. Since V12-DBE does not differentiate upper case and lower case characters, items named "HAT" or "Hat" will be selected.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
specifies a search for all items except those that cost $9.99.
specifies a search for items that cost less than $10. Items that cost exactly $10 are not selected. Example:
mSetCriteria(gTable, "ItemName", "<", "hat")
specifies an alphabetical search for items with names that precede the letter h in "hat". This includes "cap", "bonnet" but excludes "hat".
specifies a search for items that cost no more than $10. Example:
mSetCriteria(gTable, "ItemName", "<=", "hat")
specifies an alphabetical search for items with names that precede equal h in "hat". This includes "cap", "bonnet" and "hat".
specifies a search for items with catalog numbers larger than 1000. Catalog number 1000 will not be selected. Example:
mSetCriteria(gTable, "birth date", ">", "1961/12/31")
specifies a search for records with a "birth date" field occurring after Dec 31st, 1961, (excluding that date). The earliest birth date in the selection should be Jan 1st, 1962 or later.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
specifies a search for items with catalog numbers larger or equal to 1000. Catalog number 1000 will be selected. Example:
mSetCriteria(gTable, "birth date", ">=", "1961/12/31")
specifies a search for records with a "birth date" field occurring on or after Dec 31st, 1961. Therefore, the earliest birth date in the selection may be Dec 31st, 1961.
Starts
The "starts" operator can be used with fields of type string only (including custom string types). It locates records that start with a given sub-string in the specified field. Example:
mSetCriteria(gTable, "description", "starts", "hat")
sets items for selection with descriptions such as "Hat with two propellers" and "Hatchet for heavy-duty applications". If an index is defined on the field description, the search process is very fast. If not, the search takes more time but can be performed nonetheless.
Contains
The "contains" operator can be used with fields of type string only (including custom string types). It locates records that contain a given sub-string in the specified field. Example:
mSetCriteria(gTable, "description", "contains", "hammer")
sets records for selection containing descriptions such as "the greatest hammer in the world" and "casing for hammers of all sizes". Searches using the "contains" operator are inherently sequential. They cannot take advantage of any index definition and can be very slow.
WordStarts
The "wordStarts" operator can be used only with fields of type string (including custom string types) with defined full-indexes. It locates records that contain words that fully or partially match the value specified to mSetCriteria.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Example:
mSetCriteria(gTable, "description", "wordStarts", "ham")
sets records for selection containing descriptions such as "Gigantic hamburger with fries" and "The greatest hammer in the world". It does not find records containing descriptions such as "Champion" or "Gotham City" because the words in these records don't start with the sub-string "ham". Note Although words such as "hamburger" and "hammer" can be quickly found by the above query, the word "ham" will never be found because it is shorter than the minimum word length set for full-indexing.
WordEquals
The "wordEquals" operator can be used only with fields of type string with defined full-indexes. It locates records that contain words that fully match the value specified to mSetCriteria. Example:
mSetCriteria(gTable, "description", "wordEquals", "form")
sets records for selection containing descriptions such as "claim form". Records containing words such as "forms" or "formalism" would not be selected. Since "wordEquals" operates on full-indexes, searching is performed very quickly. Note Words shorter than the minimum word length set for fullindexing cannot be looked for with the "WordEquals" operator. In such cases, you must use the "WordStarts" operator instead.
would locate that record ("chocolate" contains the sub-string "cola"), whereas
mSetCriteria(gTable, "description", "wordStarts", "cola")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
would not. This is because no word in the description field starts with the string "cola".
Example:
mSetCriteria(gTable, "name", "contains", "hat") mSetCriteria(gTable, "and", "price", "<=", 50) mSelect(gTable)
The above example selects all hats up to $50.00 in the table referred to by gTable. The first call to mSetCriteria should use three parameters, and it can be chained with as many four-parameter calls as needed to specify your query. Using mSetCriteria with three parameters will reset and ignore the preceding search criteria. Another example, using the Boolean "OR" operator is:
mSetCriteria(gTable, "name", "contains", "hat") mSetCriteria(gTable, "or", "name", "contains", "helmet") mSetCriteria(gTable, "or", "name", "contains", "cap") mSelect(gTable)
It selects all records whose "name" fields contain either "hat" or "helmet" or "cap". Note Complex searches that use the OR operator are always slower than those that use the AND operator. This is true with V12 Database Engine as well as most other database management systems.
Complex criteria are very powerful but can be tricky to use. The following example illustrates complex criteria.
mSetCriteria(gTable, "name", "=", "hat") mSetCriteria(gTable, "or", "name", "=", "helmet") mSetCriteria(gTable, "and", "price", "<=", 50) mSelect(gTable)
This section of script selects all hats priced under $50.00 and all helmets under $50.00. This is very different from:
mSetCriteria(gTable, "name", "=", "hat") mSetCriteria(gTable, "and", "price", "<=", 50) mSetCriteria(gTable, "or", "name", "=", "helmet") mSelect(gTable)
where the selection consists of all hats under $50.00 and all helmets listed at any price. To illustrate the semantic difference between the two requests, we could express the first as:
(name = "hat" or name = "helmet") and price <= 50
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note
The current version of V12-DBE does not have the ability to perform searches such as
name = "hat" or (name="helmet" and price<=50)
(note the parentheses). The first two criteria are always grouped first and the third criteria is added to the result. See Appendix 9: Advanced Boolean Searches for possible workarounds.
Partial Selections
The selection process can be time-consuming if a large number of records match the criteria you specify. The worst case scenario is when all the records of a table match the specified criteria. This can handicap your project if you have no control over that the queries the end-user can express. To speed up the selection process, you can limit the number of records V12-DBE places in the selection with the following syntax of mSelect.
mSelect(gTable, from, #recs)
Example:
mSetCriteria(gT, "LastName", "=", "Smith") mSelect(gT, 1, 100)
The above example returns up to a maximum of 100 records in the selection, regardless of the total number of Smith in the database. If less than 100 Smith exist, all of them would be selected. To retrieve the next 100 records that contain "Smith" in the "LastName" field, call:
mSelect(gT, 101, 100)
Note
Partial selections also work with complex searches, but not all of them. They are only accepted for complex searches that do not use full-text indexes (i.e., WordStarts or WordEquals).
In this example, the number of records in the selection (the number of items named "hat") is stored in selSize.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
For example, assume that gTable contains a field of type string named "Banner" and that member 28 is a Text member containing the anti-aliased text "The Tiger in your Engine",
mSetField(gTable, "banner", member 28)
stores the styled Text member 28 in the field "Banner". Technically, the string "The Tiger in your Engine" is stored in the field "Banner" and the media component of the Text member is stored in an hidden Media field. To retrieve styled text, call mGetMedia as follows:
mGetMedia(gTable, "Banner", member "myBanner")
This instruction retrieves the banner image from the V12-DBE database and places it in the member named "myBanner". Note that the V12-DBE field "Banner" mentioned above is of type string and not media. Alternatively, you can retrieve the content (the individual characters) of the data contained in the field "Banner" as follows:
set aText = mGetfield(gTable, "Banner") -- assigns "The Tiger in your Engine" to aText
the second call to mSetField would replace the content of the field "Banner" with the unformatted text contained in member 28. This would replace any image associated
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
with that specific record/field by an empty image. A subsequent call to mGetMedia would then return the placeholder. Note By opening a Director 5 or 6 movie in Director 7, old Text members are automatically converted to new Text members. However, Director 5 or 6 styled texts that are stored in V12 databases cannot be converted to Director 7 text members. To you need to convert such V12 fields into Director 7compatible members, first export them to Director 5/6 Castlibs, convert the Castlibs to Director 7 and then store them back to V12-DBE. A utility movie called "Media Converter" and available from http://www.integration.qc.ca performs this conversion.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
If V12Status() returns a non-zero result, you can call V12Error() to get the details of the error. When called with no parameters, as in V12Error() this global function returns a plain-English explanation of the outcome of the last called method. If an error occurred in that last call to V12-DBE, V12Error() provides a detailed contextual report on it. Example:
set aPrice = mGetField(gTable, "price") set errCode = V12Status() if errCode <> 0 then Alert ( V12Error() ) end if
When called with a parameter, as in V12Error(errCode), this function returns the generic explanation of the code errCode regardless of the last called V12-DBE method. Example:
put V12Error(-600)
returns:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
As shown in this last example, V12Error() sometimes returns strings which contain placeholders for context specific information, such as %s or %ld. This is because the returned message is a generic explanation of the error code -600. When called without parameter, V12Error() returns a contextual explanation with the actual non-existing table name instead of %s.
CheckV12Error
The CheckV12Error() Lingo handler is often used throughout this manual and in sample projects. It is a generic error handling routine that centralizes all the error management logic is a single handler. That way, it can more easily be adapted from one project to the other, or from a debugging mode to a delivery mode (e.g. the debugging mode would display alerts, whereas the delivery mode would write an error log to an external file with the FileIO Xtra).
on CheckV12Error if V12Status() then alert V12Error() return TRUE end if return FALSE end CheckV12Error
An example of an error is File not found, when trying to import data. When a file is not found, it does not make sense to continue the importing operation until the problem is solved. An example of a warning is No previous record, when trying to go to the previous record from the first record of the selection. In such a case, the current record remains valid (although unchanged).
V12Status() returns negative codes for errors and positive codes for warnings. Often, the term error is used to designate faults of both types (i.e. errors and warnings).
Note:
Usually, you call V12Status() to get an error or warning code, then V12Error() to get a full explanation of that error or warning.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
In this example, a Lingo error is detected and the database remains open. If the database was opened in ReadWrite mode and changes were made, the database file might become corrupted. You can prevent this problem by declaring the instance variables as global variables. Example:
on doSomethingCritical global gDB, gTable set gDB = New(Xtra "V12dbe", the pathname&"catalog.V12", "ReadWrite", "top top top") set gTable = New(Xtra "V12table", mGetRef(gDB), "Articles") -- other Lingo statements -- with a syntax error somewhere which causes the handler to abort set gTable = 0 set gDB = 0 end doSomethingCritical
When a Lingo syntax error is detected and the handler aborts, you can still type
set gTable = 0 set gDB = 0
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
The above instruction exports all the fields of the selection to the file named FileName. The field and record delimiters are TAB and CARRIAGE_RETURN respectively. To specify custom field and record delimiters, use:
mExportSelection(table_instance, "TEXT", FileName, FldDelimiter, RecDelimiter)
Example:
mExportSelection(gTable, "TEXT", "Output.txt", "~", "%")
This example exports the selection in a text file named "Output.txt" with the field delimiter "~" and the record delimiter "%".
mExportSelection can also export only selected fields in the following way:
mExportSelection(table_instance, "TEXT", FileName, FldDelimiter, RecDelimiter, Field1, Field2, ...)
Example:
mExportSelection(gTable, "TEXT", "Data.TXT", TAB, RETURN, "ItemName", "catalog number", "price")
This example exports the selection in a text file named "Data.TXT" with TAB and RETURN delimiters. The only exported fields are ItemName, catalog number and price, in that order. The first line in the exported file contains the names of the exported fields separated by the selected field delimiter. The resulting text file is in the character set of the current Operating System (this is relevant only if accented characters are present in the exported data).
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mExportSelection takes the format patterns specified in mDataFormat into account. The sorting order of the exported records is identical to the one set on the selection. Media fields are ignored during the exporting process.
Or:
mExportSelection(gTable, "DBF", "Goliath.DBF", "ItemName", "catalog number", "price") -- exports only fields ItemName, catalog number and price.
string field is declared to be no larger than 255 characters. Otherwise, they are exported to field of type Memo.
Integer fields are exported to fields of type Numeric. Float fields are exported to fields of type Numeric with 10 digits after the
Note
fixed point.
Date fields are exported to fields of type Date. Media fields are ignored.
Although V12-DBE can read all kinds of DBF file variants, it exports data only in the popular DBase III format. This is mainly because DBase III is universally read by all DBFcompliant systems whereas other more recent formats are not.
Cloning a Database
Cloning a database makes a copy of an existing database file, with all the table, field and index definitions but with none of the data. This is similar to creating a database file from a template rather than starting a new project. Contrary to creating a database with mReadDBstructure (which requires a V12-DBE license to create legal V12DBE databases) this method can be used at runtime. Syntax:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mCloneDatabase(db_instance, new_pathname)
Example
mCloneDatabase(gDB, the pathname & "myClonedFile.V12")
In this example, a new database file named "Cloned.V12" is created using the same tables, fields and index definitions, as well as the same password as the database file designated by the global variable gDB. This implies that the original database file, designated by the variable gDB, must have been opened with the appropriate password prior to proceeding with the cloning. An alternate syntax for cloning databases is also supported for the purpose of backward compatibility. It is similar to creating a new instance of an existing database, and it uses the New method. Syntax:
cloned_db_instance = New(Xtra "V12dbe", new_pathname, "clone", mGetRef(main_db_instance))
where new_pathname is the pathname of the database file to be created and main_db_instance is the database instance that serves as a model for the clone. Example:
set gClone= New(Xtra "V12dbe", "myClone.V12", "clone", mGetRef(gDB))
In this example, the new Xtra instance gClone refers to the file "myClone.V12".
Example:
mPackDatabase(gDB, the pathname & "Packed_DB.V12") mPackDatabase(gDB, "LAN/Shared/Projects/Barney/KidsStuff.V12")
The first example compresses gDB into a new file named Packed_DB.V12 located in the same folder as the current Director movie. The second example compresses gDB into a new file named KidsStuff.V12 located on a different volume (removable media, LAN, etc.) At the end of the operation, database_instance stays valid (referring to the nonpacked database) and NewFilePathName is a new file that can be opened with V12DBE.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
If you just need to compress your current database without creating a new file, you can do so by compressing it into a new temporary database, deleting your initial database and renaming the temporary database to your initial database's name. FileXtra, a free Xtra delivered with recent versions of Director (also available for download at http://www.littleplanet.com/kent/kent.html), comes in handy as shown below:
-- let fName be your V12 database's name -- first make sure to set all table instance to 0 mPackDatabase(gDB, the pathname&"temp.V12") if CheckV12Error() then exit -- don't continue if pack failed DeleteFile(the pathname&fName) RenameFile(the pathname&"temp.V12", the pathname&fName)
pathname is the name of the database to fix and new_pathname is the name of the fixed database, which may reside on a different volume. mFixDatabase is a static method (its first parameter is the Xtra library itself, not on
mFixDatabase tries to read data from "Crash.V12" and saves the data to
"Recovered.V12". Note:
mFixDatabase attempts to save a corrupted file as much as
possible, but there is no guarantee on the result. mFixDatabase essentially attempts to rebuild the indexes of a damaged V12-DBE file, but if the file's headers or data clusters are damaged, chances are that the recovery process will fail.
Progress Indicators
V12 Database Engine can display a progress indicator to the user when performing time-consuming tasks such as mImportFile, mExportFile, mGetSelection, mSelect, mSelDelete, mFixDatabase and mPackDatabase. Such a progress indicator can optionally feature a Cancel button to enable users to interrupt the current
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
task. You can also replace the standard V12-DBE progress bar by any custom progress indicator you provide via Director and Lingo. Note
mSelect preceded by mSetCriteria with simple or
complex criteria enables the display of a single progress indicator for the selection task, except if the criteria contain wordStarts or wordEquals operators. In that case, as many progress indicators as criteria are displayed. To activate the progress indicator, set the ProgressIndicator property to With_Cancel, Without_Cancel or UserDefined. To deactivate it, set it to None.
Without_Cancel
Without_Cancel: V12-DBE displays its own progress bar when performing one of the above mentioned tasks. No "Cancel" button is shown and the current task cannot be interrupted. You can set the ProgressIndicator.Message property to whatever message you wish to display in the upper part of the progress window. If you set the ProgressIndicator.Message property to an empty string, V12-DBE displays its own context-dependant message.
UserDefined
V12-DBE does not display a progress bar of its own. Instead, it calls three Lingo handlers that must be defined in your movie: V12BeginProgress, V12Progress and V12EndProgress. See User Defined Progress Indicators below.
None
No Progress Indicator is shown and no callbacks are performed to Lingo handlers (default value). See also Properties of Databases / ProgressIndicator.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
In this example, V12BeginProgress is an empty handler, but it must be present. V12Progress only uses the prog parameter because it indefinitely rotates among four
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
cursors (which are one-bit depth members defined in members 27, 28, 29 and 30). V12EndProgress is responsible of restoring the standard pointer cursor. The "Progress" Mini-Sampler (available on http://www.integration.qc.ca) demonstrates other uses of progress indicators, including user-defined ones.
Changing a Password
You can change the password assigned to a database by using the mSetPassword method. The new password can be an empty string. The syntax is as follows:
mSetPassword(gDB, oldPassword, newPassword)
Example:
mSetPassword(gDB, "houdini", "ali baba")
Properties of Databases
V12-DBE databases contain generic properties that provide for technical information on the current V12-DBE environment (such as the number of available indexes and the state of the active debugger) and allow for the control of the V12-DBE environment (such as custom string types and custom weekday names).
mSetProperty and mGetProperty are used to assign and read these generic database properties. Certain properties can only be read, not written (i.e. the number of available indexes) while others can be read and written (i.e. custom string types)
Certain properties are persistent (i.e. saved to the database and recovered when the database is reopened), others are not. The syntax for mGetProperty is:
set val = mGetProperty(gDB, PropertyName)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
PropertyName is a valid identifier (see Appendix 3: Capacities and Limits for the
Note:
mSetProperty can be used to define a new property or to change an existing one. Using mSetProperty with a value of EMPTY deletes that property. Properties
pertaining to Strings (see The String Property below) cannot be deleted. Note:
mSetProperty is a very powerful tool. If you are unsure
about what youre doing, always work on a copy of your original database. Valid PropertyNames and Values are listed below. Both parameters must be of type String. Both are case insensitive (hence "resources", "Resources" and "RESOURCES" are all three equivalent). You can retrieve the list of all the properties of a database by calling mGetPropertyNames, as in
set props = mGetPropertyNames(gDB)
Note:
Predefined Properties
ProgressIndicator
Read-Write, persistent. Valid values are "None", "With_Cancel", "Without_Cancel", "UserDefined". Default value is "None".
set x = mGetProperty(gDB, "ProgressIndicator") mSetProperty(gDB, "ProgressIndicator", "With_Cancel")
Enables V12-DBE to show a progress indicator while performing time-consuming tasks, or calls back Lingo handlers to enable custom progress indicator implementations. See Progress Indicators.
ProgressIndicator.Message
Read-Write, persistent.
set msg = mGetProperty(gDB, "ProgressIndicator.Message")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
This property sets the text that must be displayed in the upper part of V12-DBE's progress window. If you set it to an empty string, V12-DBE displays a message that depends on the current operation. See Progress Indicators.
VirtualCR
Read-Write, persistent. Valid values: any ASCII character. When importing or exporting data, convert Carriage Returns (ASCII #13) to this ASCII character. This is convenient to avoid the confusion of real Carriage Returns with Record Delimiters. This property can be overridden by a specific VirtualCR character passed as parameter to mImport.
set c = mGetProperty(gDB, "VirtualCR") put CharToNum(c) show ASCII number in message window -mSetProperty(gDB, "VirtualCR", NumToChar(10)) -- define ASCII character #10 as virtual CR
CharacterSet
Read-Write, persistent. Valid values: "Windows-ANSI", "Mac-Standard", "MS-DOS". Default: "Windows-ANSI" on the Windows version of V12-DBE and "Mac-Standard" on the Macintosh version of V12-DBE. This property affects all of V12-DBE's import and export functions. It can be overridden by a specific character set passed as parameter to mImport. Translates imported and exported files (whether Text or DBF) with the "WindowsANSI", "Mac-Standard" or "MS-DOS" character set tables.
mSetProperty(gDB, "CharacterSet", "Mac-Standard")
Resources
Read-only, non-persistent.
put mGetProperty(gDB, "resources")
Returns information on the number of available indexes and the index used by the last call to mSelect. Example:
-- Number of indexes used: 6 -- Current index in table 'articles': 'nameNdx', using field 'name'
V12-DBE resources should not be confused with the MacOS resources (those normally edited with ResEdit) - they are completely unrelated.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
CurrentDate
Read-only, non-persistent.
mGetProperty returns the current date in V12-DBE's raw format (YYYY/MM/DD)
Verbose
Read/write, non-persistent. Valid values are "on" and "off". When Verbose is set to "on", V12-DBE constantly displays a detailed feedback on the tasks it is performing in Director's Message Window, Example:
mSetProperty(gDB, "verbose", "on") mGetProperty(gDB, "verbose")
Avoid setting both the Verbose and the ErrorLog properties to "on" at the same time, otherwise Director's Message Window will be quickly loaded with lengthy error logs at every call to V12-DBE.
Months
Read/write, persistent. Valid values: any 12 word string. The Month property contains the names of the months used by mDataFormat to format dates (the MMMM pattern in mDataFormat). The Value parameter is any 12word string. Words must be separated by spaces. Names of months that contain spaces themselves must be enclosed between apostrophes. Example:
mSetProperty (gDB, "Months", "Gennaio Febbraio Marzo Aprile Maggio Giugno Luglio Agosto Settembre Ottobre Novembre Dicembre")
ShortMonths
Read/write, persistent. Valid values: any 12 word string. The ShortMonth property contains the short names of the months used by mDataFormat to format dates (the MMM pattern in mDataFormat). The Value parameter is any 12-word string. Words must be separated by spaces. Short names of months that contain spaces themselves must be enclosed between apostrophes. Example:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mSetProperty (gDB, "ShortMonths", "Jan Fv Mar Avr Mai Juin Juil Aot Sep Oct Nov Dc")
Weekdays
Read/write, persistent. Valid values: any 12 word string. The Weekdays property contains the names of the weekdays used by mDataFormat to format dates (the DDDD pattern in mDataFormat). The Value parameter is any 12word string. Words must be separated by spaces. Names of weekdays that contain spaces themselves must be enclosed between apostrophes. Example
mSetProperty (gDB, "Weekdays", "Montag Dienstag Mittwoch Donnerstag Freitag Samstag Sonntag")
ShortWeekdays
Read/write, persistent. Valid values: any 12 word string. The ShortWeekdays property contains the short names of the weekdays used by mDataFormat to format dates (the DDD pattern in mDataFormat). The Value parameter is any 12-word string. Words must be separated by spaces. Short names of weekdays that contain spaces themselves must be enclosed between apostrophes. Example
mSetProperty (gDB, "ShortWeekdays", "Lun Mar Mie Jue Vie Sab Dom")
ErrorLog
Read/write, persistent. Valid values: "on" and "off". Default value: "off". When the ErrorLog property is set to "off", V12-DBE's error log and status code are reset before each call to a V12-DBE method. When ErrorLog is set to "on", error messages are cumulated in an error log as V12DBE methods are called. Likewise, the status code is set to reflect the most recent error/warning code according to the following rule: Syntax:
mSetProperty(database_instance, "ErrorLog", on_or_off)
If no error occurred, V12Status() reflects the code of the most recent warning, If no warning was reported, V12Status() signals a success.
Example:
mSetProperty(gDB, "ErrorLog", "on")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
When ErrorLog is "on", the error log and status code can be explicitly cleared by calling the global function V12ErrorReset. Resetting the ErrorLog property to "on" or "off" also clears the error log and status code. When ErrorLog is "on", the maximum number of messages allowed for logging can be adjusted with the MaxLoggedErrors property. Avoid setting both the Verbose and the ErrorLog properties to "on" at the same time, otherwise Director's Message Window will be quickly loaded with lengthy error logs at every call to V12-DBE.
MaxLoggedErrors
Read/write, persistent. Valid values: any integer between 1 and 1000. Default value: 32. When the ErrorLog property is set to "on", the maximum number of messages that can be cumulated can be set with the MaxLoggedErrors property. Syntax:
mSetProperty(database_instance, "MaxLoggedErrors", Max)
As V12-DBE's methods are called, error messages cumulate in an error log and can be retrieved at any time with the V12Error() function. The V12-DBE error log and status code can be explicitly cleared by calling the global function V12ErrorReset. Example:
mSetProperty(gDB, "MaxLoggedErrors", "100") The above example sets the maximum number of messages allowed for cumulation to 100. Note that the last parameter is "100" (a string), not 100 (an integer).
SharedRWcount
Read only, non-persistent. Returns the number of users currently using the database in Shared ReadWrite mode. Example:
set nbUsers = mGetProperty(gDB, "SharedRWcount")
DBversion
Read only, non-persistent. Returns the version of the V12-DBE Xtra used to create the database. Example:
set v = mGetProperty(gDB, "DBversion") put v
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
String.Language
Read/write, persistent. Valid values: any valid search/sort table (see Appendix 16: String and Custom String Types) The String property defines or modifies custom string types (i.e. string fields that obey to particular searching and sorting rules). To define a new string type, or modify an existing one, you append its name to "String.". The chosen name must be a valid identifier and cannot contain periods ("."). Example:
mSetProperty (gDB, "String.Klingon", field "CompTable")
In this example, field "CompTable" contains the search/sort descriptor for Klingon as defined in Appendix 16: String and Custom String Types. Once this property is defined, you can use the type "Klingon" to define new fields with mCreateField or mReadDBstructure. You also need to define this property first before modifying other string properties such as Delimiters, StopWords and MinWordLength. To modify the sort order of the default string, just omit the Language identifier:
mSetProperty (gDB, "String", field "NewCompTable")
String.Language.Delimiters
Read/write, persistent. Valid values: any valid delimiters descriptor. Delimiters defines, for an existing string type, the list of characters that are acceptable as word delimiters for full-text indexing. By default, word delimiters for the predefined types are all non-alphanumeric characters (everything except 0-9, A-Z, a-z and accented characters). Example:
mSetProperty (gDB, "String.Spanish.Delimiters", "!?@$%?&*()[]^{}=+-,./\|")
In the above example, the punctuation characters indicated as the Value parameter are considered as delimiters. If you need to specify the double-quote as part of the delimiters, either use the Lingo constant QUOTE, or place the delimiters in a Director member of type Field and use that field as a Value parameter as follows :
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
All non-printing characters such as TAB, Space, CTRL+J, etc. (i.e. characters lower than ASCII 32) are always considered as delimiters. To modify the delimiters of the default string, just omit the Language identifier:
mSetProperty(gDB, "String.Delimiters", field "newDelimiters")
String.Language.MinWordLength
Read/write, persistent. Valid values: an integer in the range 1..100 passed as a String parameter. MinWordLength determines the size of the shortest word that must be considered for full-indexing. All words shorter than MinWordLength are ignored and hence refused by the mSetCriteria method when used with the operator "WordEquals". Example:
mSetProperty (gDB, "String.Spanish.MinWordLength", "3")
Note that the Value parameter is "3" (with quotation marks). This is because mSetProperty expects a Value parameter of type String only. The following is also a valid formulation:
mSetProperty(gDB, "String.Spanish.MinWordLength", String(3) )
To modify the MinWordLength of the default string, just omit the Language identifier:
mSetProperty(gDB, "String.MinWordLength", "2")
String.Language.StopWords
Read/write, persistent. Valid values: a string no longer than 32K. StopWords allows for the definition of a list of words that must be ignored in the fullindexing process. The Value parameter is a string containing the stop words in any order separated by spaces, TAB or Carriage Returns). Example:
mSetProperty (gDB, "String.Spanish.StopWords", "in on the a")
To modify the stop words list of the default string, just omit the Language identifier:
mSetProperty(gDB, "String.StopWords","a the on for in by as")
By default, the StopWords property is empty. A typical list of stop words in English is:
a by in the an for is this and from it to are had not was as have of with at he on which be her or you but his that
Note
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Q: A:
Q:
A:
Q: A: Q:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
A:
Both you and your client need a license for V12-DBE. The only other alternative is for you to permanently transfer your V12-DBE license to your client. Integration New Media must be notified of such permanent transfers. If you decide to transfer you license, you must make sure not to keep a copy of the registration number and the license file. At all time, a V12-DBE license file can be installed only on a single computer. We are two employees of the same company working on a project involving V12DBE. Both of us need to create database structures and/or write scripts to call V12DBE methods. Do we both need V12-DBE licenses? Yes. You need two separate V12-DBE licenses, unless you share the same computer. A V12-DBE license file can be installed on only one computer at a time. I am working on a project involving V12-DBE, however I never need to create or modify database structures, neither do I write or modify V12-DBE related scripts. Do I need a V12-DBE license. No. If you only need to view or modify the content (add/delete records) of a V12-DBE database, no license is required. If your project requires you to create or modify a V12DBE database structure (a.k.a adding/deleting tables), or if you need to write V12-DBErelated scripts, then you must have a V12-DBE license. I developed a software tool that uses V12-DBE and I want to make it available to colleagues and associates for use at authoring time. Must they also have V12-DBE licenses? Yes. Users of software that use V12-DBE in an authoring environment must have V12DBE licenses. As a student, am I entitled to an educational license of V12-DBE? Yes, but you must conform to specific conditions. To obtain an educational license of V12-DBE, you agree to use V12-DBE only for educational purposes. Educational means that V12-DBE is intended for use by students and faculty of educational institutions only for non-commercial projects. What are my obligations as V12-DBE license holder? In your project, you must mention "Portions of code are Copyright (c)1995-99 Integration New Media, Inc." next to your own copyright notice. You must also place the "Powered by V12" logo on the packaging of your product or within your product (in the Credits section, About box or equivalent location). The "Powered by V12" logo is available on the V12-DBE CD-ROM and on Integration New Media's web site (http://www.integration.qc.ca).
Q:
A: Q:
A:
Q:
A: Q: A:
Q: A:
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
(f) Any third party who may distribute or otherwise make available a product containing the V12-DBE Runtime Kit must purchase its own V12-DBE license. (g) Any third party who will use the V12-DBE Runtime Kit in an authoring environment must purchase his own V12-DBE license. 2. Restrictions. The Software contains trade secrets in its human perceivable form and, to protect them, you may not MODIFY, TRANSLATE, REVERSE ENGINEER, REVERSE ASSEMBLE, DECOMPILE, DISASSEMBLE OR OTHERWISE REDUCE THE SOFTWARE TO ANY HUMAN PERCEIVABLE FORM. YOU MAY NOT MODIFY, ADAPT, TRANSLATE, RENT, LEASE, LOAN OR CREATE DERIVATIVE WORKS BASED UPON THE SOFTWARE OR ANY PART THEREOF. 3. Copyright notices. You may not alter or change Integration's copyright notices as contained in V12-DBE. You must include (a) a copyright notice, in direct proximity to your own copyright notice, in substantially the following form "Portions of code are Copyright (c)1995-99 Integration New Media, Inc."; and (b) place the "Powered by V12" logo on the packaging of your Products; or (c) place the "Powered by V12" logo within your Products in the credits section. 4. Acceptance. V12-DBE shall be deemed accepted by you upon delivery unless you provide Integration, within two (2) weeks therein, with a written description of any bona fide defects in material or workmanship. 5. Termination. This Agreement is effective until terminated. This Agreement will terminate immediately without notice from Integration or judicial resolution if you fail to comply with any provision of this Agreement. Upon such termination you must destroy the Software, all accompanying written materials and all copies thereof, and Sections 7 and 8 will survive any termination. 6. Limited Warranty. Integration warrants for a period of ninety (90) days from your date of purchase (as evidenced by a copy of your receipt) that the media on which the Software is recorded will be free from defects in materials and workmanship under normal use and the Software will perform substantially in accordance with the manual. Integration's entire liability and your sole and exclusive remedy for any breach of the foregoing limited warranty will be, at Integration's option, replacement of the disk, refund of the purchase price or repair or replacement of the Software. 7. Limitation of Remedies and Damages. In no event will Integration, its parent or subsidiaries or any of the licensers, directors, officers, employees or affiliates of any of the foregoing be liable to you for any consequential, incidental, indirect or special damages whatsoever (including, without limitation, damages for loss of profits, business interruption, loss of business information and the like), whether foreseeable or not, arising out of the use of or inability to use the Software or accompanying written materials, regardless of the basis of the claim and even if Integration or an Integration representative has been advised of the possibility of such damage. Integration's liability to you for direct damages for any cause whatsoever, and regardless of the form of the action, will be limited to the greater of US $350.00 or the money paid for the Software that caused the damages.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
THIS LIMITATION WILL NOT APPLY IN CASE OF PERSONAL INJURY ONLY WHERE AND TO THE EXTENT THAT APPLICABLE LAW REQUIRES SUCH LIABILITY. BECAUSE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU. 8. General. This Agreement will be construed under the laws of the Province of Quebec, except for that body of law dealing with conflicts of law. If any provision of this Agreement shall be held by a court of competent jurisdiction to be contrary to law, that provision will be enforced to the maximum extent permissible, and the remaining provisions of this Agreement will remain in full force and effect. 9. The parties acknowledge having requested and being satisfied that this Agreement and its accessories be drawn in English. Les parties reconnaissent avoir demand que cette entente et ses documents connexes soient rdigs en anglais et s'en dclarent satisfaits. The following trademarks are used throughout this manual: Director and Xtra are trademarks of Macromedia, Inc., FileMaker Pro is a trademark of Claris corp., Windows, Access and MS Excel are trademarks of Microsoft corp., Macintosh is a trademark of Apple corp., 4th Dimension is a trademark of ACI, Photoshop is a trademark of Adobe Systems Inc.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Any date later than January 1st, 1600 can be compared, retrieved and stored to fields of type Date. However, date formatting is limited to the range Jan 1st 1904 through Dec 31st 2037. No two fields or indexes can have the same name in the same table. However, two fields or two indexes might have the same name in different tables. Fields of type media can hold any type of media that can be stored in a Director member, except Film Loops and QuickTime movies. Up to 32 custom string types can be defined.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
DBF files of type DBase III, DBase IV, DBase V, FoxPro 2.0, FoxPro 2.5, FoxPro 2.6, FoxPro 3.0 and FoxPro 5.0 can be imported, exported and used as templates for the definition of V12 databases. Fields of type DateTime are not supported. The following DBF data types are ignored: General, CharacterBinary, Memo-Binary. On Win9x/NT, MS Access databases, MS FoxPro files, MS Excel workbooks and MS SQL Server data sources can be used as templates to create new V12 database and as sources of data to import records from through ODBC drivers. The exact database translation/data importing rules varies among ODBC drivers and versions of ODBC drivers. Identifiers (names of fields, tables and indexes) are limited to 32 characters. They must start with a low-ASCII alphabetic character (a..z, A..Z) and can be followed by any alphanumeric character (0..9, a..z, A..Z, , , ). Keywords such as NOT, AND, OR, String, Integer, Float, Date or Media are not suitable for use as identifiers. When indexing fields of type String, up to the 200 first characters of each string are actually entered in the index. The remaining characters are ignored. Full-indexes are built with words not exceeding 31 characters. Words longer than 31 characters are truncated to 31 characters for the purpose of indexing (this does not affect the actual data). New database structures cannot be created at runtime without the presence of a V12-DBE license file (actually, they can, but they will be non-licensed V12 databases). They can only be cloned from existing databases.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
MacOS example:
new(Xtra "V12dbe", "MyNetworkDrive:Data:Catalog.V12", "Shared ReadWrite", "password")
At most 128 users can open a V12-DBE file in Shared ReadWrite mode. Note: If a user opens a database in "Shared ReadWrite" mode, any attempt to open it in an exclusive mode (ReadWrite or ReadOnly) will fail. If the database is open in "Shared ReadWrite", other users can also open it "Shared ReadWrite" mode. If the database is open in an exclusive mode ("ReadWrite" or "ReadOnly"), it cannot be opened by any other user.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Possible Configurations
Scenario 1: User 1 and User 2 access the same V12 database on a Remote Server. This is the typical multi-user access configuration.
Scenario 2: User 2 accesses the same V12 database file as User 1, on User 1s computer. User 1 and User 2 use separate instances of the projector and V12-DBE Xtra.
Scenario 3: User 1 with two distinct Projectors, each with its own copy of the V12-DBE Xtra share a single V12 database. NOTE: for the Mac version to properly run in this scenario, File Sharing must be set and the V12 database must be in a shared folder.
Scenario 4: User 1 and User 2 share the same projector, V12-DBE Xtra, and V12-DBE database file (this scenario requires a locked projector file on a Windows computer).
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
This example defines two table instances (gTable1 and gTable2) for the table articles. The selection in gTable1 is sorted by order of price, whereas in gTable2 it is sorted by order of name. Note: 1. The multiple instance definition technique is sometimes convenient for Read-Only databases but can lead to inconsistencies when used in Read/Write mode. This happens particularly when editing a current record which is also the current record of the other instance. 2. Each table instance takes up RAM.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Move the V12*.LIC file out of that folder to the destination of your choice, except of course, the trash can or the recycle bin, Open your project either with a Projector or Macromedia Director and perform the tests. Once the tests are completed, close the Projector or Macromedia Director and put the license file back in its original folder. DO NOT attempt to rename or tamper with the license file. If you do, you may need to re-register V12-DBE.
Note
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Everything that is a static document is cross-platform compatible. This includes: Director movies (either protected or not) V12-DBE databases
The following figure identifies which files are specific to Macintosh or Windows, and which files are compatible to both Macintosh and Windows.
Director movies (.DIR, .DXR) Shockwave movies (.DCR) Projector for Windows V12-DBE Xtras for Windows V12-DBE databases Projector for Macintosh V12-DBE Xtras for Macintosh
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
it contains the following 10 records: Preference 27 35 50 54 60 75 87 92 95 100 Thing Raindrop on roses Whiskers on kittens Bright copper kettles Warm woolen mittens Round paper packages tied up with strings Cream-colored ponies Crisp apple strudels Door bells and sleigh bells Schnitzels with noodles Wild geese that fly with the moon on their wings
The table is currently sorted by order of Preference, using that field's index and the current record is the first record (27-Raindrop on roses). Any modification to the Thing field does not affect the order of the selection. However, modifying the Preference field would automatically cause the table to be resorted with respect to the current index's sort order. For example, modifying the value 27 above for 90 would instantly update the selection to the following order, with the current record pointing to the 7th record. Preference 35 50 54 60 75 80 90 92 95 100 Thing Whiskers on kittens Bright copper kettles Warm woolen mittens Round paper packages tied up with strings Cream-colored ponies Crisp apple strudels Raindrop on roses Door bells and sleigh bells Schnitzels with noodles Wild geese that fly with the moon on their wings
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
This behavior may seem even stranger when the V12-DBE Behaviors are used. In that case, if the current record is #1, the value 27 is changed to 90 and the user clicks on the Next button (theoretically to view record #2: 35-Whiskers on kittens), the record 50-Bright copper kettles is displayed. This is because the mGoNext method called by the Next button updates record #1 thus relocating it as record #7, and then goes to the new record #2 which is 50-Bright copper kettles. To avoid this behavior, you must prohibit the modification of fields used in the current index. Or better yet, create an additional indexed field that can be used as an internal ID. This is how many database engines work internally. Note Selections defined by calls to mSetCriteria/mSelect are not affected by this symptom.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
or
mSetCriteria(gT, mSetCriteria(gT, mSetCriteria(gT, mSetCriteria(gT, mSelect(gT) "Ingredients", "WordStarts", "celery") "OR", "Ingredients", "WordStarts", "pumpkin") "OR", "Ingredients", "WordStarts", "carrot") "OR", "Ingredients", "WordStarts", "eggs")
The above query finds all soups and appetizers that require less than 30 minutes of preparation time. This is not equivalent to:
mSetCriteria(gT, "TimeToPrepare", "<=", 30) mSetCriteria(gT, "AND", "DishType", "=", "soup") mSetCriteria(gT, "OR", "DishType", "=", "appetizer") mSelect(gT)
which finds all soups that require less than 30 minutes of preparation time and all appetizers regardless of the time required to prepare them. Thus, the order in which criteria are expressed to V12-DBE is important. However, V12-DBE cannot handle four criteria or more with alternating ANDs and ORs. For example, the query "(Dish is soup or appetizer) and (Main Ingredient is celery or eggplant)" cannot be directly expressed to V12-DBE. Following are three techniques to workaround this limitation. Many others can be easily derived from those techniques, but they all require some Lingo programming.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mSelect(gT1) -- on gT2 mSetCriteria(gT2, "ingredient", "WordEquals", "celery") mSetCriteria(gT2, "OR", "ingredient", "WordEquals", "eggplant") mOrderBy(gT2, "RecipeID") -- sort by the same field as gT1 above mSelect(gT2)
You end up with gT1 and gT2 referencing two separate selections, both ordered by RecipeID. You can run a small Lingo loop to intersect them:
set field "result" = EMPTY -- Dir member. Can also be a Lingo list repeat while not V12Error() -- by "Next" on last rec of gT1 or gT2 set s1 = (mGetField(gT1, "RecipeID") set s2 = (mGetField(gT2, "RecipeID") if (s1 = s2) then put mGetField(gT1, "RecipeName")&RETURN after field "result" mGoNext(gT1) mGoNext(gT2) else if (s1 < s2) then mGoNext(gT1) else mGoNext(gT2) end if end repeat
This Lingo loop performs an AND (intersection) between two selections. It can easily be modified to perform an OR (union). If you need to run your query with 3, 4, 5,... sets of criteria, just modify the above Lingo loop to operate on 3, 4, 5,... V12table instances.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
If there is a third part to you query, mark your selection with a 2 in the "Marker" field, and keep on going. For best performance, the first query must be the most restrictive, that is, the one that yields the least results. At the end, restore the marked fields to 0 so to prepare them for another query.
At runtime, to perform a user query such as (Origin is Org1 AND Dish is Type1) or (Origin is Org2 AND Dish is Type2) you run the script
mSetCriteria(gTable, "OriginType", "=", Org1 & Type1) mSetCriteria(gTable, "OR", "OriginType", "=", Org2 & Type2) mSelect(gTable)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
You can also store and retrieve styled double-byte strings with calls to
mSetField(gTable, "name", member 5 of castlib "V12stuff") mGetField(gTable, "name", member 5 of castlib "V12stuff")
See Managing Styled Text for details on the storage and retrieval of styled text.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Work Around
A convenient and easy way to work around the above limitations is to manage doublebyte strings as if they were media. That is, only use them for the purpose of storage and retrieval, and use additional fields of type Integer or single-byte String to store codes that would determine the searching behavior and sorting order of the corresponding double-byte strings. Either fields of type String or Media can be used to store such double-byte strings.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
At step 6, you can optionally preview your report instead of printing it by replacing the call to tMsPrintReport() by tMsPreviewReport()
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Example #1: printing a specific field in a record For example, to print the content of selected fields of a record first design as report similar to this:
"Recommend Diet for" is a mPrint Text object. "FirstName" is a mPrint variable. In mPrint Designer, choose Code > Generate > Director Lingo. You get the following script:
tMsRegisterMPrint("mp-xxxxxxxxxx") tMsCreateReport(the pathname&"myReport.mpf") tMsBeginRegion("MainRegion") tMsSetVariable("FirstName","--value--") tMsEndRegion() tMsPrintReport() tMsFreeReport()
by
tMsSetVariable("FirstName", mGetField(gT, "FirstName"))
Your report is ready for printing. Example #2: printing multiple records from a V12-DBE selection This example shows how to print the first ten records of a V12-DBE selection with mPrint. Printing any other number of records, or the entire selection, is similar. First define a Repeat Region with the mPrint Designer.
"Top Ten Performers" is a mPrint Text object named TEXT1. "FirstName" is a mPrint variable. The rectangle enclosing "FirstName" is a Repeat Region named "NameListRegion".
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
In mPrint Designer, choose Code > Generate > Director Lingo. You get the following script:
tMsRegisterMPrint("mp-xxxxxxxxxx") tMsCreateReport(the pathname&"NameList.mpf") tMsBeginRegion("MainRegion") repeat with i=1 to "--loop count--" tMsBeginRegion("NameListRegion") tMsSetVariable("FirstName","--value--") tMsEndRegion() end Repeat tMsEndRegion() tMsPrintReport() tMsFreeReport()
Your report is ready for printing. Example #3: printing multiple columns This example shows how to print two columns on a mPrint report: the left column is a list of products. The right column in a list of prices matching each product of the left column. The right column is right-aligned. This example also shows how to print a sum at the bottom of a column. This technique can be easily extended to print a product, mean, standard deviation, etc. In mPrint Designer, draw two Regions. In each region, create a Repeat Region: one for each column. In the left region Repeat Region, create a variable named ProductName. In the right region Repeat Region, create a variable named Price. Open the Properties of the Price variable, and choose Alignment: Right. Finally, in the PriceColumn Region but outside of the PriceList Repeat Region, create a variable named Total.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
tMsRegisterMPrint("mp-xxxxxxxxxx") tMsCreateReport(the pathname&"TwoCols.mpf") tMsBeginRegion("MainRegion") tMsBeginRegion("ProductColumn") repeat with i=1 to "--loop count--" tMsBeginRegion("ProductList") tMsSetVariable("ProductName","--value--") tMsEndRegion() end Repeat tMsEndRegion() tMsBeginRegion("PriceColumn") tMsSetVariable("Total","--value--") repeat with j=1 to "--loop count--" tMsBeginRegion("PriceList") tMsSetVariable("Price","--value--") tMsEndRegion() end Repeat tMsEndRegion() tMsEndRegion() tMsPrintReport() tMsFreeReport()
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Note that the statement that prints "Total" was moved to after the repeat loop.
Then, if you want to print the content of a specific V12-DBE field at the current coordinates location of PrintOMatic, call V12-DBE's mGetField method followed by PrintOMatic's append method. Example:
set x = mGetField(gT, "FirstName") append doc, x, FALSE
If you want to print an entire selection, call mGetField in a loop (mGetSelection cannot be of much help). Example:
repeat with i = 1 to mSelectCount(gT) set prod = mGetField(gT, "FirstName") append doc, prod & RETURN, FALSE end repeat
If you want to compute a function (e.g., number of items, sum, average, product, mean, standard deviation, etc.), initialize a Lingo variable and keep updating it in your loop. Example: to compute the average price of all the products in a selection:
set n = mSelectCount(gT) set total = 0 repeat with i = 1 to n set prc = mGetField(gT, "price") append doc, prc & RETURN, FALSE set total = total + prc end repeat append doc, "Total=" & total & REUTRN, FALSE append doc, "Average=" & total/n & REUTRN, FALSE
To print multiple columns with PrintOMatic, you must first create frames in your document. For example, to print a list of products along with their corresponding prices (prices must obviously right-adjust), you would write a script similar to the following:
on PrintProdAndPrice set doc = new(xtra "PrintOMatic") newPage doc -- add a new page -- products frame is 200 pixels wide, 600 pixels tall newFrame doc, Rect(0,0,200,600), FALSE repeat with i = 1 to mSelectCount(gT) mGo(gT, i) set prod = mGetField(gT, "prodName") append doc, prod & RETURN, FALSE end repeat -- prices frame is 50 pixels wide, 600 pixels tall
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
newFrame doc, Rect(200,0,250,600), FALSE setTextJust doc, "right" -- right-align column repeat with i = 1 to to mSelectCount(gT) mGo(gT, i) set price = mGetField(gT, "prodName") append doc, price & RETURN, FALSE end repeat printPreview doc -- or, to print: print doc set doc=0 end PrintProdAndPrice
It is very convenient, with PrintOMatic, to first preview your page before printing it. To preview a page, call
printPreview doc
Note
The reports printed by the above PrintOMatic sample scripts are not visually identical to the ones illustrated in the mPrint section. You need to add a few page layout and font styling scripts to match those illustrations.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
one such index is defined). There is no performance handicap in using one index or another. However, at any time, only one index can be used by V12-DBE. Thus, if you call mOrderBy and mSelect in a single query, V12-DBE uses the best index it can to build the selection, and then sorts the selection without relying on indexes1.
mSelect chooses its best index based on the following algorithm. Assume that your
query is :
(Field1 = A) AND (Field2 starts B) AND (Field3 < C)
V12-DBE first checks if Field1 is the first segment of an index (i.e., a simple index is defined for it, or it is the first field of a compound index). If such an index exists, it is automatically considered to be the best index for the query. Otherwise, V12-DBE checks if Field2 is the first segment of an index. If so, that index is the best index for the query. Otherwise, V12-DBE attempts to apply the same logic to Field3. If none of Field1, Field2 and Field3 is indexed, or appears in the first segment of a compound index, the table's default index is used. Note This logic does not apply to OR operators. AND operators further refine a selection, whereas OR operators constantly add new data to them. This is also why queries with ORs are slower than those with ANDs.
The index chosen by mSelect determines the selection's default sorting. Thus, if Field1 is not indexed and Field2's index is chosen, the following script yields a selection sorted by Field2:
mSetCriteria(gT, "Field1", "=", A) mSetCriteria(gT, "AND", "Field2", "starts", B) mSetCriteria(gT, "AND", "Field3", "<", C) mSelect(gT)
Actually, V12-DBE can use two or more indexes for a single search. However, for the purpose of combined search and sort operations, using an index for sorting would require more CPU effort than actually sorting the selection with Quicksort. Quicksort is the most efficient sorting algorithm known to date.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Further assume that Field2 contains a lot of duplicate values, the sub-sorting order of the duplicate records would be determined by the chosen index's second segment, or the order in which records are input if the chosen index is not compound. As a result, you can control the sorting order of your selection without calling
mOrderBy.
The following query uses the index LastNameNdx. It delivers a selection sorted by LastName and then by order of input. Since all the last names in the selection would be identical ("Smith"), the selection's sorting order would be the order in which records were added to the database.
mSetCriteria(gT, "LastName", "=", "Smith") mSelect(gT)
If you need to sort all the Smiths in your table by order of First Name, run the following script:
mSetCriteria(gT, "LastName", "=", "Smith") mOrderBy(gT, "FirstName") mSelect(gT)
You can optimize this script by slightly modifying your database structure as follows:
[TABLE] Addresses [FIELDS] LastName string FirstName string YearOfBirth integer [INDEXES] LastNameNdx duplicate LastName ascending FirstName ascending FirstNameNdx duplicate FirstName ascending
yields a selection sorted by FirstName. You can further optimize your queries by imposing a specific index for your search, if more than one index fits the best index criteria. Assume, for example, that your table contains two compound indexes: one for LastName/FirstName and one for LastName/YearOfBirth:
[TABLE] Addresses [FIELDS] LastName string FirstName string YearOfBirth integer [INDEXES]
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
LastFirstNdx duplicate LastName ascending FirstName ascending LastBirthNdx duplicate LastName ascending YearOfBirth ascending FirstNameNdx duplicate FirstName ascending
The query:
mSetCriteria(gT, "LastName", "=", "Smith") mSelect(gT)
automatically chooses LastFirstNdx as its best index, thus delivering a selection sorted by LastName and then FirstName. If you need your selection sorted by LastName and then YearOfBirth, run the following script:
mSetCriteria(gT, "LastName", "=", "Smith") mSetCriteria(gT, "AND", "YearOfBirth", ">", 0) -- bogus criterion mSelect(gT)
The criterion (YearOfBirth > 0) does not affect your selection in any way (since any data stored in this field is always greater than 0). However, its presence forces V12-DBE to use the LastBirthNdx index thus resulting in a selection sorted by YearOfBirth.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Table Students and Scores are related to each other through their respective ID and StudentID fields. A shorthand notation to express this is:
1 N
Example:
ID 127 128 129 STUDENTS LastName FirstName Cartman Eric Broslowsky Kyle McCormick Kenny TestID 1081 1284 2015 1081 2015 1081
If you look at the relation the other way around, that is starting from the Scores table, you get a N-1, or Many-to-One relation noted:
N 1
In exceptional cases, relations can be established from a table's records onto records of the same table.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Assume that we add a Tests table to the database to store the description of each test.
[TABLE] Tests [FIELDS] ID integer indexed Title string indexed Topic string indexed Author string CreationDate date LastUpdateDate date
Field TestID of table Scores refers to field ID of table Tests. This is another Manyto-One relation:
N 1
The structure of the overall database now contains three tables and can be represented by the following Entity-Relation Diagram.
ST UDENT S
ID inte ger La stName string Fi rstName strin g Email strin g Fa cul ty strin g
T EST S
ID inte ger Title string Topic string Autho r string Creati onDate date La stUpda teDate date
Many-to -On e
Many-to -On e
SCORES
TestID inte ger StudentID inte ger Score inte ger Time Spent i nteg er
Tables Students and Tests are said to be in a Many-to-Many relation. In this example, we were lucky enough to have a Scores tables that naturally links Students and Tests, but in many cases, creating a Many-to-Many relation is not obvious: you often need to create a fake table that only contains the IDs of both sides' entities. Such a table is called an Associative Table: It's sole purpose is to put other tables in relation with each other. V12 Database Engine does not contain a language that automatically resolve relations between tables. Instead, it relies on Lingo to do so.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
At the end of this script, gTScores'selection contains LName's scores sorted lowest to highest. Example: if LName was assigned the string "Cartman" in the above example, after the execution of the above script, table gTScores' selection would contain:
TestID 1284 1081 2015 SCORES StudentID Score 127 45 127 90 127 98
At the end of this script, gTStudents' current record is the one gTScores's current record is related to. Example: if the current record in table gTScores was
1081 128 75
Another more complex Many-to-One relation resolving question would be "list the last names of all the students who scored 75 or higher at test number 1081". It can be answered by the following script:
-- first locate all Scores records that match criteria mSetCriteria(gTScores, "TestID", "=", 1081) mSetCriteria(gTScores, "AND", "Score", ">=", 75) mSelect(gTScores) -- loop through all Student Ids and append them to member "result" put EMPTY into field "result" repeat with i = 1 to mSelectCount(gTScores) mGo(gTScores, i) sID = mGetField(gTScores, "StudentID")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
mSetCriteria(gTStudents, "ID", "=", sID) mSelect(gTStudents) put mGetField(gTStudents, "LastName")&RETURN after field "result" end repeat
This script lists the last names of all the students that match the specified criteria in a Director member, in contrast to the previous script which leaves them in a V12-DBE selection. Although a V12-DBE selection can be easily dumped to a Director field, the opposite is not true. Thus, if you need to further manage the list of last names created above, you must set the current record to the one that matches a specific last name's and then perform the required operation. This is sometimes called the lazy approach, whereby a piece of data is accessed only when it is needed (as opposed to processing data before it is actually needed, which may yield faster results, but at a higher pre-processing overhead). V12-DBE's high-speed data search and retrieval routines enable you to implement the lazy approach without handicap of performance.
For example, assuming that Mrs. Crabtree is the author of both the Trigonometry and the Rocket Science courses, running this script on the above example would yield the following result:
Cartman Broslowsky
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
McCormick Broslowsky
A shortcoming of this script is it's inability to sort the results, or to remove duplicates from the results. A possible work around this limitation consists in creating an additional field named Marker in table Students and, instead of immediately listing all last names in field "result", setting the Marker field of found records to 1. At the end, just find all marked records in table Students. Of course, this requires the database to be on a writeable volume.
-- find all students who took one of Mrs.Crabtree's tests -- and list their last names in alphabetic order, without duplicates -- first locate all Tests authored by Mrs Crabtree mSetCriteria(gTests, "Author", "=", "Crabtree") mSelect(gTests) put EMPTY into field "result" -- loop through each test created by Mrs.Crabtree repeat with i = 1 to mSelectCount(gTests) mGo(gTests, i) set tID = mGetField(gTests, "ID") mSetCriteria(gTScores, "testID", "=", tID) mSelect(gTScores) -- loop through student IDs and retrieve name repeat with j = 1 to mSelectCount(gTScores) mGo(gTScores, j) set sID = mGetField(gTScores, "StudentID") mSetCriteria(gTstudents, "ID", "=", ) mSelect(gTstudents) -- mark the found record mEditRecord(gTstudents) mSetField(gTstudents, "Marker", 1) mUpdateRecord(gTstudents) end repeat end repeat -- once all records are marked, select them all mSetCriteria(gTstudents, "Marker", "=", 1) mOrderBy(gTstudents, "LastName") mSelect(gTstudents) put mGetField(gTstudents, "literal") into field "results" -- DO NOT forget to restore Markers to 0 to prepare -- for next search
In the above example, this modified script would yield the result:
Broslowsky Cartman McCormick
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Modifying an existing database's structure is a tedious task and can be easily worked around as follows: 1. 2. 3. 4. Dump the structure of your initial database (see Viewing the Structure of a Database). Modify the returned database descriptor. Create a new V12 database based on the modified descriptor. Import the content of each table to the new V12 database (see Importing from V12-DBE).
The above steps can be executed either through Lingo handlers, or using the V12-DBE Tool.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
on decrypt str set res = "" -- first clean up escape codes set str = cleanEscape (str) set keyLength = length (gEncryptKey) set strLength = length (str) repeat with i = 1 to strLength set keyIdx = i mod keyLength set res = res & numToChar ((charToNum (char i of str) - charToNum (char keyIdx of gEncryptKey) + 256) mod 256) end repeat return res end decrypt on cleanEscape str -- just replace every instance of 0101 by 01, and 0102 by 00 set res = "" set strLength = length (str) repeat with i = 1 to strLength if (charToNum (char i of str) = 1) then if (charToNum (char i + 1 of str) = 2) then set res = res & numToChar (0) else if (charToNum (char i + 1 of str) = 1) then set res = res & numToChar (1) end if set i = i + 1 else set res = res & char i of str end if end repeat return res end cleanEscape
To use the above handlers, first assign the encryption key of your choice to the global variable gEncryptKey. Then, at startup, call initCrypt (e.g., on StartMovie). To store an encrypted string to a V12 table, call:
mSetField(gT, "Account", encrypt(secretData) )
You can further enhance the strength of your encryption by creating an additional field in your table for the encryption key as opposed to using the same global gEncryptKey for all fields and records. Thus, each record would be encrypted with a different key, making it harder to hackers to crack your algorithm. If you want to encrypt dates, floats or integers, convert them to strings first.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
means that: K sorts after J and before L, j and J are equivalent (likewise, k and K are equivalent, and l and L are equivalent too) Characters omitted from a sorting and searching rules table are considered to sort after those listed in the table, except for Control characters (such as Carriage Return, Horizontal Tab, Vertical Tab, etc.) which are considered to sort before those listed in the table.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38.
% | [] {} () <> * + / \ = ~ - & @ 0
50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76.
cC d D eE f F g G h H iI j J k K l L mM nN o O p P q Q r R sS t T uU vV w W x X yY z Z
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
From then on, the type String.Klingon can be used in mCreateField and mReadDBstructure to define new fields.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Initialization
new (V12dbe) new (V12Table)
Retrieving Data
mGetField (V12Table) mGetMedia (V12Table) mGetSelection (V12Table) mGetUnique (V12Table) mDataFormat (V12Table)
Importing Data
mImport (V12Table) mImportFile (V12Table)
Modifying Data
mAddRecord (V12Table) mDeleteRecord (V12Table) mEditRecord (V12Table) mSelDelete (V12Table) mSetField (V12Table) mSetMedia (V12Table) mUpdateRecord (V12Table)
Error Management
V12Error (Global) V12status (Global)
Database Structures
mReadDBStructure (V12dbe) mBuild (V12dbe) mDumpStructure (V12dbe)
Database Utilities
mGetProperty (V12dbe) mSetProperty (V12dbe) mSetPassword (V12dbe)
Special Methods
mCustom (V12dbe) mCustom (V12Table)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters (none) Description Adds a new record to the table and sets it as the current record. Calls to mAddRecord are generally followed by calls to mSetField and must end with a call to mUpdateRecord. Example
-- add a record to gTable, put data in fields "name" and "price" and updates the record: mAddRecord(gTable) mSetField(gTable, "field1_string", "funnel") mSetField(gTable, "field2_float", 2.95) mUpdateRecord(gTable)
See Also
mEditRecord, mSetField, mUpdateRecord
Parameters (none) Description Create the database structure defined by mReadDBstructure and writes it to a disk file. After successfully calling mBuild, the database remains open in ReadWrite mode. Data can be immediately imported to it. Example
-- Reads the database definition contained in a text file: set gDB = New(Xtra "V12dbe", "myBase", "Create", "very secret password") mReadDBStructure(gDB, the pathname & "DatabaseDef.txt") set mBuild(gDB)
See Also
new, mReadDBstructure.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters (none) Description Undocumented generic method for project-specific implementations. Contact Integration New Media, Inc. for specific implementations.
Parameters (none) Description Undocumented generic method for project-specific implementations. Contact Integration New Media, Inc.for specific implementations.
Parameters fielName = name of field to which format must be applied. format = format applied to the content of fieldName. Description Associate a formatting pattern to the data retrieved from fieldName. Data formats can be applied to fields of type Float, Integer and Date. If the retrieved data is longer then the formatting pattern, V12 returns the corresponding number of "#": 56.78 would be returned as "#.##" if the format was set to "9.99". Example
mDataFormat(gTable,"date","dd/mm/yy") -- characters can be added before the data such as: -- 56.78 is formated to "00056.78": mDataFormat(gTable, "price", "99999.99") -- 56.78 is formated to "56.78$": mDataFormat(gTable, "price", "99.99$") -- 56.78 is formated to " 56.87": mDataFormat(gTable, "price", "###.99")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
See Also
mGetField, mGetSelection
Parameters (none) Description Delete the current record. After calling mDeleteRecord, the record following the current record becomes the new current record. If no record follows the deleted record, the preceding record becomes the new current record. If no record precedes the deleted record, the current record is not defined. Example
mDeleteRecord(gTable)
See Also
mAddRecord, mEditRecord
Parameters (none) Description Retrieve information on a database structure. Very convenient for debugging. Example
put mDumpStructure(gDB) put mDumpStructure(gDB) into field "dummy"
Parameters (none)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Description Enable the modification of the current record. A normal record modification sequence consists of a call to mEditRecord, a sequence of calls to mSetField and a call to mUpdateRecord. Example
mEditRecord(gTable) mSetField(gTable, "name", "funnel") mSetField(gTable, "price", 2.95) mUpdateRecord(gTable)
See Also
mAddRecord, mSetField, mUpdateRecord
mFind (V12Table)
-- alternative to mGo
Parameters fieldName = name of the field to read. dataFormat = patten for Integer, Float and Date formatting. Description Retrieve the content of field FieldName for the current record. If dataFormat is specified, the retrieved data is formatted accordingly. Otherwise, if a formatting pattern is assigned to FieldName with mDataFormat, that format is taken into account. mGetFields dataFormat parameter overrides mDataFormats setting. Example
set name = mGetField(gTable, "theName") set date = mGetField(gTable, "theDate", "YY-MM-DD")
See Also
mDataFormat, mGetSelection, mGetMedia, mSetField
Parameters fieldName = name of the field from which media is retrieved. member = cast member in which media is stored.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Description Replace the content of cast member Member with the media contained in the fieldName field of the current record. Example
-- get the media from field "photo" and -- store in the cast named "thePhotoCast" in castlib 1: mGetMedia(gTable, "photo", Member "thePhotoCast") -- or: mGetMedia(gTable, "photo", member "thePhotoCast" of castlib 1)
See Also
mDataFormat, mGetSelection, mGetField, mSetMedia
Parameters (none) Description Return the position of the current record in the selection. Example
put mGetPosition(gTable)
See Also
mGo, mGoPrevious, mGoNext, mGoFirst, mGoLast, mSelectCount
mGetPropertyNames
-- introduced with V12 3.0. Return names of properties.
Parameters Prop = "virtualCR" | "characterSet" | "resources" | "currentDate" | "weekDays" | "shortWeekDays" | "months" | "shortMonths". Description Retrieve the value of the property Prop. Example
put mGetProperty(gDB, "characterSet") -- return: "Windows-ANSI"
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
put mGetProperty(gDB, "months") -- return: "January February March April May June July -- August September October November"
See Also
mSetProperty
Parameters outputType = LITERAL | LIST | PROPERTYLIST From = number of first record to retrieve (default = position of current record) #recs = number of records to retrieve (default value is Size of selection - From +1) FieldDelimiter = delimiter between fieldsn (default = Tab, for LITERAL only) RecordDelimiter = delimiter between record (default = Return, for LITERAL only)) FieldNames = any number of field names Description Retrieve one or more fields in one or more records of the selection. Optionally, you can specify custom field and record delimiters (with the Literal option only. Delimiters are not supported by the List and PropertyList options). If fieldNames are omitted, all fields are returned. Otherwise, only the specified field are returned. LITERAL returns a string. LIST returns a Lingo list. PROPERTYLIST returns a Lingo property list. Example
set x = mGetSelection(gTable) set x = mGetSelection(gTable, "LITERAL", mGetPosition(gTable), 1) set x = mGetSelection(gTable, "LITERAL", 1, mSelectCount(gTable), TAB, RETURN, "number", "name", "price")
Notes Use mError to discover whether mGetField has succeeded, mGetField is the only method that follows this rule. See Also
mGetField, mSetField, mDataFormat
mGetUnique (V12Table)
-- similar to mGetSelection. Operates on Master Field only. Returns unique values.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters toPosition = index of a record in the selection. Description Set the current record to the toPosition nth record of the selection. Example
-- set the current record to the 45th of the selection. mGo(gTable, 45)
See Also
mGoFirst, mGoLast, mGoNext, mGoPrevious and mGetPosition
Parameters (none) Description Set the current record to the first record of the selection. Example
mGoFirst(gTable)
See Also
mGoLast, mGoPrevious, mGoNext, mGo and mGetPosition
Parameters (none) Description Set the current record to the last record of the selection. Example
mGoLast(gTable)
See Also
mGoFirst, mGoPrevious, mGoNext, mGo and mGetPosition
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters (none) Description Set the current record to the record following the actual current record in the selection. Example
mGoNext(gTable)
See Also
mGoFirst, mGoLast, mGoPrevious, mGo and mGetPosition
Parameters (none) Description Set the current record to the record preceding the actual current record in the selection. Example
mGoPrevious(gTable)
See Also
mGoFirst, mGoLast, mGoNext, mGo and mGetPosition
mImport (V12Table)
-- New method: import from Text, DBF, ODBC drivers
Parameters inputType = type of the file to import: LITERAL | TEXT | V12 | DBF. inputData = pathname of file to import. fieldDelimiter and recordDelimiter = single-character delimiters.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
password = the password (for V12 files importing). tableName = an identifier (for V12 files importing). Description Import the data from the specified source. Syntax varies according to inputType. See manual. Example
-- import from within Director: mImportFile(gTable, "LITERAL", field "data") -- Default delemiters: TAB and RETURN: mImportFile(gTable, "LITERAL", field "data", TAB, RETURN) -- import from a TEXT file: mImportFile(gTable, "TEXT", "data.txt", TAB, RETURN) -- import from a V12 database file -- you need to specify the password, put "" if there is -- none, and specify from which table the data is taken -- from: mImportFile(gTable, "V12", the pathname & "data.v12", "password", "table") -- import from a DBF database file: mImportFile(gTable, "DBF", the pathname & "data.DBF")
Notes During the importation of data from a V12 database, if two fields bear the same name but are of different types, try type casting. The index of the files from which you are importing the data are not taken into consideration. Only the indexes of the host files are brought up-to-date. See Also
mEditRecord, mUpdateRecord
Parameters fieldName = name of field to use as the sorting key. SortOrder = ascending | descending, Default = ascending Description Sort the selection according to field fieldName.This method is normally called just before the mSelect method is used. NOTE: when mOrderBy is used before mSelectAll, fieldName must be indexed. Example
mOrderBy(gTable, "lastName") -- ascending by default. mSelect(gTable) mOrderBy(gTable, "lastName", "ascending") mSelect(gTable) mOrderBy(gTable, "lastName", "descending") mSelect(gTable)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
See Also
mSelectAll, mSelect, mSetIndex
Parameters inputType = "LITERAL" | "TEXT" | "V12" | "DBF" inputData = database descriptor expression (if inputType = "LITERAL) or pathname of template file (otherwise) password is releavnt only if inputType = "V12". Description Create a new database or modify an existing one. mReadDBstructure can read a definition from a string, field or variable (LITERAL), from a text file (TEXT), from another V12 database file or from a DBF file (DBF). The size of the database descriptor is limited to 32K. Example
-- read a definition from a Director field member: mReadDBStructure(gDB,"LITERAL",field "definition") -- read a definition from a TEXT file: mReadDBStructure(gDB,"TEXT", the pathname & "definition.txt") -- read a definition from a V12 database file: mReadDBStructure(gDB,"V12", the pathname & "definition.v12", "top secret") -- read a definition from a DBF database file: mReadDBStructure(gDB,"DBF", the pathname & "definition.dbf")
See Also
new, mBuild
Parameters (none) Description Delete all the records of a selection. At the end of the operation, the selection is empty. Example
-- the following will delete the current selection: mSelDelete(gTable)
See Also
mDeleteRecord
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters (none) Description Trigger the selection process. This is required after calls to mSetIndex, mSetCriteria and/or mOrderBy. If no record satisfies the search criteria, mSelect returns an empty selection and sets the current record to an undefined value. Example
-- select all records of the table and sort them by order of catalog number: mSetIndex(gTable, "CatNumberNdx") mSelect(gTable) -- select all items that cost at least $20, -- and at most $40: mSetCriteria(gTable, "price", ">=", 20) mSetCriteria(gTable, "and", "price", "<=", 40) mSelect(gTable) -- select all items that cost at most $40 -- and sort them by alphabetic order: mSetCriteria(gTable, "price", "<=", 40) mOrderBy(gTable, "name") mSelect(gTable)
See Also
mSetIndex, mSetCriteria, mOrderBy
Parameters (none) Description Select all the records of a table. The sorting order for the selection is the same as the most recently chosen index unless it is preceded by mOrderby. That index is either explicitely chosen by you (mSetIndex) or automatically chosen by mSetCriteria and/or mOrderBy. Example
mOrderby(gT,"price") mSelectAll(gTable)
See Also
mOrderby
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters (none) Description Return the number of records in the selection. If the selection is empty, this method returns 0. Example
put mSelectCount(gTable) into field "TotalHits"
See Also
mGetPosition
Parameters boolOp = and | or fieldName = fieldin which value must be searched. Operator = "=" | "<>" | "<" | ">" | "<=" | ">=" | "starts" | "contains" | "wordEquals" | "wordStarts" value is value to look for. Description Specify a search criteria. A call or sequence of calls to mSetCriteria must be followed by a call to mSelect to trigger the search process. If more than one criterion is used, subsequent criteria must use the boolean operator and or or. Example
-- finds all cases where the field "muffin" -- contains "chocolate" mSetCriteria(gTable, "muffin", "wordEquals", "chocolate") -- This instruction combines a full text search -- in two fields with an ordinary search mSetCriteria(gTable, "muffin", "wordEquals", "chocolate") mSetCriteria(gTable, "or", "donut","containsWord", "chocolate") mSetCriteria(gTable, "and", "name", "starts", "Shlomo") mOrderBy(gTable, "price")--selection doesn't apply to full Index mSelect(gTable)
See Also
mSelect, mOrderBy
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters fieldName = name of the field who's content is modified in the current record. value = value to assign to the field fieldName of the current record. Description Set the content of field fieldName, of the current record, to value. If value is not of the same type as fieldName, V12-DBE casts it to the appropriate type. If fieldName is a date, value must be a valid date in V12-DBE's raw format (YYYY/MM/DD). Calls to mSetField must be preceded by a call to mEditRecord or to mAddRecord, and must be followed by a call to mUpdateRecord. Example
-- editing an existing record: mEditRecord(gTable) mSetField(gTable, "description", field "myDescription") mSetField(gTable, "height", integer(field "height")) mUpdateRecord(gTable) -- adding a new record to the table gTable: mAddRecord(gTable) mSetField(gTable, "name", "hot dog") mSetField(gTable, "length", 2) mSetField(gTable, "price", 1.95) mUpdateRecord(gTable)
See Also
mGetField, mSetMedia, mGetMedia, mEditRecord, mUpdateRecord
Parameters indexName = name of the index to set as current index Description Set the index indexName as the current index. A call to mSetIndex must be followed by a call to mSelect. It is useless to call mSetIndex before setting search criteria as mSetCriteria selects the most appropriate index for a given query. mSetIndex is seldom used. It is still supported only for the purpose of backwarding compatiblity.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Example
-- select all records of the table and sort them by order of price: mSetIndex(gTable, "priceNdx") mSelect(gTable)
See Also
mSelectAll, mOrderBy
Parameters fieldName = name of the field in which media is to be stored. Member = cast member from which media is retrieved. Description Replace the content of the field FieldName of the current record with the cast member Member. Example
-- get the media from the cast named "thePhotoCast". -- in cast 1 and store it in the field "photo", -- of the current record: mSetMedia(gTable, "photo", member "thePhotoCast") -- or mSetMedia(gTable, "photo", member "thePhotoCast" of CastLib "internal")
See Also
mSetField, mGetMedia
Parameters oldPassword = current password. newPassword = new password. Description Change the current password (oldPassword) to a new one (newPassword). Either oldPassword and/or newPassword can be empty strings. Example
-- change the password "very secret" to "even more secret": mSetPassword(gDB, "very secret", "even more secret") -- change from an empty password to "my new password": mSetPassword(gDB, "", "my new password")
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters Prop = "virtualCR" | "characterSet" | "weekDays" | "shortWeekDays" | "months" | "shortMonths". Description Set an existing property Prop to value, or create a new property named Prop and assigns value to it. Special rules apply to properties that start with string. (see manual) Example
-- turn on the verbose property: mSetProperty (gDB, "months", "January February March April May June July August September October November December") mSetProperty (gDB, "string.MinWordLength", String(5) ) Note: See user manual for additional information.
See Also
mGetProperty
Parameters (none) Description Save modifications of the current record to the database file. A call to mUpdateRecord must be preceded by a call to mEditRecord or mAddRecord. Example
mEditRecord(gTable) mSetField(gTable, "name", field "name") mUpdateRecord(gTable)
See Also
mEditRecord, mAddRecord, mSetField
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters databaseName = name of the database file to create, clone or open. This can be a partial or full pathname to that file. openMode is the mode in which the database will be opened. Valid values are "create", "readWrite", "readOnly" and "clone". If openMode is "create", the third parameter is a password and it is stored in the database file for later reference. If openMode is "readOnly" or "readWrite", the third parameter is a password and it is checked against the one provided with "create". Description Create a database Xtra instance and returns a reference to it. Usually, that reference is assigned to a global variable and used throughout the Lingo script to refer to that database. If openMode is "create" and new database file is created. Table, field and index definitions must follow. That process must be terminated by a call to mBuild. If openMode is "readOnly", data can be read but not be written to the database. If openMode is "readWrite", data can be read and written to the database. Example
-- create a new database named "myBase" -- and lock it with password "very secret": set gDB = New(Xtra "V12dbe", "myBase", "Create", "very secret") -- open an existing database file named -- "myBase" in Read-Only mode: -- (i.e. the database cannot be modified). set gDB = New(Xtra "V12dbe", "myBase", "ReadOnly", "very secret") -- open an existing database (FirstDB.v12) and -- clone it in the directory of the current movie: set gDB1 = New(Xtra "V12dbe", "KrazyCD:DataFiles:FirstDB.v12", "ReadOnly", "top secret")
Parameters gDB = reference to the database object that contains tableName. tableName = name of table to open. Description Create a table Xtra instance and opens the table tableName. new returns a reference to that Xtra instance, which is normally assigned to a global variable for later reference. Example
set gDB = New(Xtra "V12dbe", "myBase", "ReadOnly", "Exclusive", "very secret") set gTable = New(Xtra "V12dbe", gDB, "MegaTable")
See Also
new (v12dbe)
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Parameters err = an integer (optional parameter) Description If you call v12Error without the Err parameter and right after calling a V12 method, it returns an accurate and contextual description of the result. When called with the Err parameter, a generic explanation of that error code is provided. V12Error() is global method: it is an alternate syntax to mError. Example
set errMsg = V12Error() set errMsg = V12Error(-30000)
See Also
V12status
Parameters (none) Description Return the result code of the last V12-DBE method called. A return code of 0 means no error occurred. A positive code signals a warning. A negative call signals an error. Call V12Error to get a complete explanation of the problem(s) that occurred in the last method. Example
mSetCriteria(gTable,"name","=","buzzlightyear") if V12Status() then Alert V12Error()
See Also
V12Error
XtraVersion(Global)
-- Return version of Xtra.
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Errors
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -81 Selection empty Not initialized properly Internal error Bad global area Disk read error Disk Write Error Header Read Error Header Write Error The file does not exist or is already opened Not closed properly No Space File already exists Not created properly Incomplete Data Bad Header Bad Node Bad Split Entry File Not Open File Not Closed No Root Node No Current Bad Index Number Bad data length Bad reference type Bad field reference Bad field pointer Bad field handle Bad field type Bad Sequence type Bad key length Bad key type Bad Duplicate type Buffer overflow Bad file specification Bad minimum extend Over demo limit File seek Log record number not used Double lock current info Double unlock current info Entry has bad data length Bad segment number Memory allocation error Data checksum error Data definition checksum error Unable to open database. The maximum of users as been reached Bad build key Duplicate key Invalid number of buffers Key too big Too many segments Bad lock current info Bad load shared library
-82 -83 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -201 -202 -203 -204 -205 -206 -207 -520 -530 -540 -550 -560 -570 -580 -590 -600 -610 -620 -630 -640 -650 -660 -1010 -1030 -1050 -1060 -1070 -1080
Function not loaded Function not found File locked File mode error Not enough memory or not multiuser OS Not locked Current record locked by other user Locked by self Reset error Clear schema error Bad clear byte Bad set byte Current Record already locked Bad select position number Bad field number Bad select type Bad select Op User abort Bad key number Different select types Invalid open mode Invalid parameter Bad edit mode Unknown error Invalid identifier. Valid identifiers must have at least one character Invalid identifier. First character must be alphabetic Invalid character(s) in identifier Invalid identifier length. Valid identifiers have at most 32 characters Table '%s' does not exist Field '%s' does not exist in table '%s' Field '%s' of type '%s' of table '%s' is of a type that cannot be full-indexed Invalid field type Invalid parameter. The parameter must be a valid V12base component Invalid parameter. The parameter must be a valid V12table component The database used by the table is not opened Bad table instance. Check current instance Too many records Invalid object Invalid database structure Memory allocation error Field does not exist
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
-1090 -1100 -1110 -1120 -1130 -1140 -1150 -1160 -1170 -1180 -1250 -1260 -1270 -1280 -1290 -1330 -1370 -1380 -1400 -1410 -1420 -1430 -1440 -1460 -1480 -1500 -1530
-1841
Unable to read structure from database Structure not initialized properly Corrupted DBF file Field does not exist. Please contact tech support Cannot modify table Invalid database structure. Please contact tech support Invalid identifier Cannot create text file. Maybe the file already exists Cannot create DBF file. Maybe the file already exists Cannot create DBT file. Maybe the file already exists Field does not exist Invalid field data. Please contact tech support Invalid field type Invalid field size in table No table defined Unable to set password Duplicate key Unable to create or modify a database on a locked file/volume Database not initialized properly. Please contact tech support Unable to pack database. File name already exists Table already in use. Set all instances of a table to zero MOA error in V12-DBE. Please contact Tech Support Cannot set a void value Cannot bind multiple fields with the same member name Item not found in table. Please contact tech support Current record locked by other user Cannot open database. This database structure is not supported by the current version of V12 Low-level engine not initialized Wrong number of parameters Invalid file name Invalid open mode. Valid modes are Create, ReadWrite, ReadOnly and Clone '%s' is an invalid open mode. Valid modes are Create, ReadWrite, ReadOnly and Clone V12-DBE instance was not opened properly Corrupted variables. Reboot the computer Invalid pathname File already exists Error at file creation
-1900 -1910 -1920 -1930 -1940 -1960 -2210 -2410 -2810 -2820
-3270 -3280
-3290
-3300
Error while writing header files File does not exist or is already open Not enough disk space Wrong password Cannot get password. Please contact tech support Invalid password. Check if the password is not VOID Invalid object Unable to edit database structure. Database must be opened in ReadWrite mode Unable to update database structure. Database must be opened in ReadWrite mode Not in database structure edition mode. Call mEditDBstructure before modifying database structure Wrong number of parameters Invalid pathname Empty pathname Wrong number of parameters Invalid descriptor type. Valid types are Text, Literal, V12 and DBF Invalid database descriptor. Check descriptor's syntax Unable to locate/decode password Unable to read database structure Field '%s' of table '%s' has an invalid index order. Valid orders are Ascending and Descending Missing '(*' or '*)' Unable to open TEXT file. Make sure the file is in the specified path and not used by another application Unable to open V12 file. Make sure the file is in the specified path and not used by another application Unable to open DBF file. Make sure the file is in the specified path and not used by another application Unable to modify database structure. Call mEditDBstructure first Empty file name Missing [END] tag in database descriptor Missing field name in table '%s' Field '%s' of type Media cannot be indexed Missing [TABLE] tag in database descriptor Missing table name in database descriptor Invalid field name in table '%s' Field '%s' already exists in table '%s'
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
-3900 -4010
Field '%s' of type '%s' of table '%s' is of a type that cannot be full-indexed Invalid field type in table '%s' Maximum number of indexes reached. The maximum is %ld Index '%s' already exists in table '%s' Invalid index type in index '%s' of table '%s' Missing field name for index '%s' in table '%s' Field '%s' set in index '%s' of table '%s' does not exist Missing order for index '%s' of table '%s'. Valid orders are Ascending and Descending Invalid field name. '%s' is a reserved word Field '%s' of table '%s' has an invalid field type Invalid descriptor type. Valid types are Literal, Text, DBF or V12 Empty database descriptor Table '%s' already exists Field '%s' does not exist in table '%s' Unable to edit database structure. Database must be opened in Create or ReadWrite mode Not in database structure edition mode. Call mEditDBstructure first Invalid DBF file format Buffer size not required for fields of type '%s' Invalid field size in table '%s' First character of table '%s' must be alphabetic Unable to modify database structure. Database must be opened in Create or ReadWrite mode Wrong number of parameters Invalid table name Table '%s' already exists Unable to create new table. Call mEditDBstructure before creating new tables Empty table name Unable to edit database structure. Open database in Create or ReadWrite mode Table '%s' contains invalid characters First character of table '%s' must be alphabetic Table '%s' has an invalid identifier length. Valid identifiers have at most 32 characters Cannot create table '%s'. The maximum number of table(s) is '%ld' Wrong number of parameters
-4100 -4110 -4120 -4140 -4160 -4170 -4180 -4190 -4200 -4210 -4220
-4230
-4240 -4510 -4520 -4530 -4540 -4550 -4560 -4570 -4580 -4590 -4591 -4600
Invalid table name Invalid field name Invalid field type Invalid buffer size Table '%s' does not exist Database structure not created properly Field '%s' already exists in table '%s' Unable to create new field. Call mEditDBstructure and mCreateTable before creating new fields Empty table name Empty field name Invalid buffer size. Buffer size must be greater than zero Buffer size not required for fields of type '%s' Unable to use '%s' as a field name. This is a reserved word Invalid index type. Valid index types are indexed and full-indexed Unable to edit structure of table '%s'. Table already built Unable to edit database structure. Open database in Create or ReadWrite mode Field '%s' of table '%s' contains invalid characters First character of field '%s' in table '%s' must be alphabetic Field '%s' of table '%s' has an invalid identifier length. Valid identifiers have at most 32 characters Field '%s' of table '%s' cannot be indexed. It must have at most 29 characters to be indexed Cannot create field '%s'. The maximum number of field(s) is '%ld' Wrong number of parameters Table '%s' does not exist Field '%s' does not exist in table '%s' Database structure not created properly Invalid table name Invalid field name Invalid index name Invalid index type. Valid types are Duplicate and Unique Invalid index order. Valid orders are Ascending and Descending '%s' is an invalid index order. Valid orders are Ascending and Descending Unable to create index. Call mEditDBstructure, then create new tables and new fields before creating new indexes
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
-4690 -4700 -4710 -4910 -4920 -4930 -4940 -4950 -4960 -4970 -5110 -5120 -5130 -5140
Maximum number of indexes reached. The maximum is %ld Empty table name Empty index name Empty field name Empty index type. Valid types are Unique and Duplicate Empty index order. Valid orders are Ascending and Descending Field '%s' already used in index '%s' of table '%s' Unable to edit database structure. Database must be opened in Create or ReadWrite mode Field '%s' of type Media specified in table '%s' cannot be indexed Unable to edit structure of table '%s'. Table already built Cannot create compound index '%s'. Limited to '%ld' field(s) per index Unable to delete table. Database must be opened in Create or ReadWrite mode Unable to edit database structure. Call mEditDBstructure first Table '%s' does not exist Unable to open table Empty table name Table already in use. Set all instances of a table to zero before deleting it Cannot delete table. Database must be opened in Create or ReadWrite mode Database structure not created properly Missing index. Table '%s' must contain at least one index Unable to edit database structure Unable to modify database structure. Use mEditDBStructure and mUpdateDBStructure to change a database structure Unable to build database. Database must be opened in Create or ReadWrite mode Unable to update database structure. At least one index per table is required Unable to build database structure. At least one index per table is required Wrong number of parameters Invalid password. Password should not exceed 32 characters Invalid character(s) in password Wrong password. '%s' does not match with the current password
-5640 -5650 -5660 -5670 -5680 -5690 -5700 -5810 -5820 -5830 -5840 -5850 -5860 -5870 -5880 -5890 -5900 -5910 -5920
-5930
-5940 -5950
-5990
-6010
Unable to write to database. Database must be opened in ReadWrite mode Wrong number of parameters Database structure not created properly Invalid output format. Please consult the manual to get a description of the different output formats Table '%s' does not exist Field '%s' does not exist in table '%s' Can only get size information on fields of type Media or String Invalid table name Invalid field name Empty table name Empty field name Property does not exist Invalid property Missing apostrophe. A substring was left open-ended Unable to write to database. Database must be opened in ReadWrite mode Cannot delete or set the property value to blank Cannot modify the property value Cannot change verbose value. Invalid verbose type Cannot set week days. Invalid number of days Cannot set months. Invalid number of months Cannot modify property. The string type associated does not exist Cannot modify property. The string type associated is already used Cannot modify MinWordLength property. This property must be greater than 0 and smaller than 100 Cannot define new string type. String type names cannot contains periods (dots) Cannot set property name. Too many characters Cannot set new string type. The maximum number of custom string types is reached Invalid log value. Must be set to 'on' or 'off' Invalid maximum value. Must be a number between 1 and 1000 Invalid progress indicator value. Must benone, with_cancel, without_cancel or userdefined Invalid Character Set value. Must beDos-US, MacStandard, Windows-ANSI or Default Property does not exist
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
-6160 -6170 -6180 -6190 -6200 -6210 -6220 -6410 -6420 -6430 -6440 -6450 -6460 -6470 -6480 -6490 -6810 -6820 -6830 -6840
-6850 -6860 -6870 -6880 -6890 -6900 -6910 -6920 -6931 -6940 -6950 -6970 -6980 -6990 -7050 -7070 -7210 -7410 -7620
Memory allocation error Wrong number of parameters V12base instance not properly opened Invalid table name Missing table definition in database. At least one table must be defined in a V12 database No such table in database Failed to open table. Database file not open. Table was defined but not written to database Table not found Invalid object Empty table name Cannot create table instance. Only one table instance can be created Wrong number of parameters Invalid export type Invalid pathname Invalid field delimiter Invalid record delimiter Invalid field name Field '%s' does not exist Invalid record delimiter length Invalid field delimiter length Wrong number of parameters Wrong number of parameters Wrong number of parameters Parameter #2 should be either a valid pathname or a valid source type (Literal, Text, DBF or V12) Invalid pathname Invalid record delimiter Invalid field delimiter Invalid import type. Must be Literal, Text, DBF or V12 Import error Unable to open DBF file. Check pathname Unable to open TEXT file. Check pathname Empty file name Field %ld does not exist Empty table name Database not properly initialized Invalid DBF file format Field and record delimiters must be different Unable to import data. Database must be opened in ReadWrite mode Cannot use line feed (LF) as field delimiter Duplicate key occurred at line '%ld' Selection empty. No current record Selection empty. No current record Selection empty. No current record
-7820 -8410 -8420 -8430 -8610 -8620 -8630 -8640 -8650 -8660 -8670 -8680 -8690 -8700 -8710 -8720 -8730 -8740 -8750 -8760 -9010 -9020 -9030 -9050 -9410 -9420 -9610 -9620 -9810 -9820 -10010 -10020 -10030 -10040 -10050 -10060 -10410 -10440 -10450 -10460 -10470 -10480 -10490 -10500 -10810 -10820 -10830 -10840 -10850 -10860 -10870
Selection empty. No current record Index '%s' does not exist Invalid index name Empty index name Wrong number of parameters Invalid field name Invalid operator Invalid field type Invalid operator Invalid operator Field does not exist No memory available Empty field name Operator not allowed for this type of field Field '%s' is not fullindexed Field '%s' does not exist Word length is smaller than the minimum of indexed words (%ld) Cannot specify boolean operator in first criteria String must have at least one character Maximum number of criteria reached Wrong number of parameters Field '%s' does not exist Invalid index order Empty index name Selection empty. No current record Outside of selection range Unable to delete selection. Database must be opened in ReadWrite mode Unable to delete record #%ld. This record is locked by another user Invalid result Selection empty Field does not exist Invalid field name Empty field name Field '%s' does not exist Cannot get field when selection is empty Wrong number of parameters Invalid value. Please contact tech support Parameter incompatible with type of destination field Invalid field name Unable to modify data. Call mEditRecord first Media exceeds buffer size declared upon database creation Empty field name '%s' is an invalid date Field '%s' does not exist Wrong number of parameters Empty media field Empty field name Field '%s' does not exist CastLib %ld does not exist Unable to find member '%s' The parameter must be a (cast) member
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
-10880 -11010 -11020 -11030 -11040 -11050 -11060 -11070 -11080 -11710 -11730 -11910 -11920 -12130 -12140 -12710 -12730 -12731 -12740 -12741 -12750 -13010 -13025 -13030 -13035 -13045 -13050 -13410 -13420 -13610 -13630 -13640 -13650 -13660 -13670 -13680 -14010 -14020 -14030 -14040 -14041 -14050 -14060 -14070 -14080 -14410 -14420
Cannot get field when selection is empty Wrong number of parameters Cast member empty Invalid field name Empty field name Empty media field Field '%s' does not exist Unable to modify data. Call mEditRecord first Unable to import this kind of media Unable to edit record. Database must be opened in ReadWrite mode Selection empty. No current record Cannot write data. Call mEditRecord first Duplicate key '%s'. Check the following field(s) %s Unable to delete record. Database must be opened in ReadWrite mode Selection empty. No current record Wrong number of parameters Cast '%s' does not exist Cast %ld does not exist Cast member %s does not exist Cast member %ld does not exist Invalid member identifier Wrong number of parameters Field '%s' is not bound. Call mBindField first Cast '%s' does not exist Cast %ld does not exist Cast member %s %ld does not exist Field '%s' does not exist Wrong number of parameters Invalid member identifier Wrong number of parameters Unable to find Field '%s' Cast '%s' does not exist Cast %ld does not exist Cast member '%s' does not exist Cast member %ld does not exist Unable to update record. Database must be opened in ReadWrite mode Wrong number of parameters Field '%s' does not exist Cast %ld does not exist Cast member %s does not exist Cast member %ld does not exist Wrong number of parameters. Please consult the manual You must specify a CastLib Cast member '%s' not found Invalid CastLib identifier Wrong number of parameters Field '%s' does not exist
-14430 -14440 -14450 -14460 -14810 -14850 -14860 -14870 -14890 -14910 -14920 -14930 -14940 -14950
-14960 -15210 -15230 -15610 -15620 -15630 -15650 -15660 -15670 -15680 -15810 -15820
-15830 -16010 -16020 -16030 -16040 -16050 -16410 -16420 -16430 -16440 -16450 -16460
Invalid parameter. Third parameter cannot be of type String Invalid member identifier Invalid parameter 3, attempt to get the binding type Cannot bind field. The member '%ld' is already bound Wrong number of parameters Database structure not created properly Invalid table name Invalid field name Field '%s' does not exist in table '%s' Unable to create fullindex. Call mEditDBstructure first Empty table name Empty field name Field '%s' of type '%s' specified in table '%s' cannot be full-indexed Unable to edit database structure. Database must be opened in Create or ReadWrite mode Unable to edit structure of table '%s'. Table already built Conflicting Add/Edit mode. Call mUpdateRecord before creating a new record Unable to add record. Database must be opened in ReadWrite mode Wrong number of parameters Only fields type Integer, Float, and Date can be formatted Invalid data format Missing apostrophe. A substring was left open-ended Too may periods (.) in format specifier. At most one period is allowed Empty field name Cannot set field format. 200 is the maximum format length Wrong number of parameters Invalid output format. Please consult the manual to get a description of the different output formats Error number required Wrong number of parameters Invalid pathname Empty pathname Invalid new pathname Empty new pathname Wrong number of parameters Invalid table name Empty table name Invalid old field name Empty new field name Cannot rename field. Database must be opened in Create or ReadWrite mode
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
-16830
-16840
Table '%s' does not exist Field '%s' does not exist in table '%s' Unable to rename field '%s' of table '%s'. Table already built Unable to modify database structure. Call mEditDBstructure first Cannot rename field. Field '%s' already exist in table '%s' Field '%s' does not exist Invalid output format. Please consult the manual to get a description of the different output formats Invalid start position. Must be a number greater than zero (0) and smaller than the number of records in the selection Invalid number of records to read. Must be a number greater than zero and smaller than the number of records in the selection Invalid field delimiter Invalid record delimiter Invalid field name
7040
7060
Warnings
1390 1450 1470 1510 1520 1950 1970 File is opened in ReadOnly mode. Check if medium or file is read only Cannot update bound fields. Not in ReadWrite mode No field match. No data copied File is opened in ReadOnly mode. Can't open in Shared Readonly mode File is opened in ReadWrite mode. Can't open in Shared Readwrite mode Old database version. It was opened in ReadOnly mode This database is still in demo mode. To legalize it, please open it once in ReadWrite mode Already in database structure edition mode. Call mUpdateDBstructure before calling mEditDBstructure again Unsupported dbf field type Fields of type media cannot be indexed
7080 7610 7810 10070 11720 12120 12760 14970 15220 16880 16890
2420
Fields of type '%s' cannot be full-indexed Unable to export binary field type. Field '%s' not exported in DBF file Field '%s' has been truncated to ten characters Selection empty. No current record Field '%s' of type Media cannot be export Field '%s' does not exist '%s' is an invalid date. Default date has been set Field '%s' at line '%ld' is longer than the '%ld' allocated for it and was truncated Too many field delimiters at line '%ld'. The extra data was ignored Missing field delimiter(s) at line '%ld'. Some fields were set to default data Field '%s' is defined of type media in your database. Use mSetMedia to store data in it The field '%ld' of your definition has been truncated. Exceed the maximum number of characters for a field (32) DBF field '%s' of type '%s' does not match the V12 type '%s' Unsupported dbf field type Unable to select records beyond end of selection. %ld record(s) in selection Unable to select records preceding first record of selection Current record is edited by another user. Data could change mEditRecord already called. Call mUpdateRecord prior to calling mEditRecord again No current record Cannot generate a member beyond the size of the castLib Field '%s' is already fullindexed in table '%s' Already in database structure addition mode Selection empty. No current record Field '%s' of type Media cannot be retrieved with mGetSelection
3620 4130
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Index
A Ascending ............................................... 96 ASCII Character Set ............................... 42 B Basics Documentation.................................... 24 Binding Automatic ........................................... 93 Data .................................................... 91 Full...................................................... 92 Safe ..................................................... 93 Types .................................................. 92 Boolean operator .................................. 100 Buffer size .............................................. 46 C Capacities ............................................. 129 Character Set .................... 33, 42, 117, 163 Cloning ................................................. 109 Closing an Xtra....................................... 22 Comments (in database descriptors) ....... 48 Compressing a Database file................. 110 Corrupted Database Files...................... 111 Creating Database ............................................. 49 Xtra-Instance ................................ 21, 50 Current Record ................................. 75, 76 D Data Formatting ................................ 79, 85 Data Model ............................................. 38 Data Preconditioning ............................ 141 Database Descriptors .............................. 45 Date ...................................................... 109 raw format............................... 42, 90, 96 DBF File Formats ............................. 43, 52 Deleting a Record ................................... 90 Delimiters (Full-Text)............................. 30 Descending ............................................. 96 E End User ............................................... 135 Error Codes........................................... 192 Error detection ........................................ 21 Errors ....................................105, 106, 107 Exporting Data...................................................108 DBF Format ......................................109 Text Format.......................................108 F Field Delimiter ........................................80 Field Descriptor ................................39, 65 Field Type ...............................................32 Fixing a Database file............................111 Flat database............................................30 Float ......................................................109 Formatting Dates ...................................................86 Integers and Floats ..............................86 Freeing up Disk Space ..........................110 Full-text Indexing....................................30 Delimiters..........................................121 Shortest words...................................121 Stop words ........................................122 G Generation of Members...........................93 Global functions......................................25 V12Error ...........................................105 V12Status..........................................105 I Importing A text File............................................65 Data into a V12-DBE Database ..........74 From a DBF File .................................67 From a Literal......................................66 Media ..................................................71 Indexes ....................................................28 Installing V12-DBE ................................16 Integer ...................................................109 International ....................................33, 163 L Languages .......................................33, 163 Limits ....................................................129 M Master Field ............................................76
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-99
Media.............................................. 71, 109 Methods .................................................. 22 mAddRecord....................................... 88 mAutoBinding .................................... 94 mBindField ......................................... 91 mBuild ................................................ 60 mCloneDatabase ............................... 110 mDataFormat .............................. 85, 109 mDeleteRecord ................................... 90 mDumpStructure................................. 61 mEditRecord....................................... 89 mExportSelection ............................. 108 mFind.................................................. 78 mFixDatabase ................................... 111 mGenerateMembers............................ 93 mGetField ........................................... 79 mGetMedia ................................. 88, 103 mGetPosition ...................................... 76 mGetProperty.................................... 115 CurrentDate .................................. 117 DBversion..................................... 120 Delimiters ..................................... 121 ErrorLog ....................................... 119 MaxLoggedErrors......................... 119 MinWordLength ........................... 121 Months.......................................... 118 ProgressIndicator .................. 112, 116 ProgressIndicator.Message ........... 116 Resources...................................... 117 SharedRWcount............................ 120 ShortMonths ................................. 118 ShortWeekDays ............................ 119 StopWords .................................... 122 String ............................................ 121 Verbose......................................... 117 VirtualCR...................................... 116 Weekdays...................................... 118 mGetPropertyNames......................... 115 mGetRef........................................ 74, 75 mGetSelection..................................... 80 mGetUnique........................................ 84 mGo .............................................. 77, 79 mGoFirst............................................. 77 mGoLast ............................................. 77 mGoNext ............................................ 77 mGoPrevious ...................................... 77 mImport .......... 65, 66, 67, 68, 69, 70, 71 mImportFile .................................. 66, 67
mMessageList .....................................24 mOrderBy............................................76 mPackDatabase .................................110 mReadDBstructure..................51, 52, 55 mRefreshBoundFields.........................93 mSelDelete ..........................................91 mSelect................................................95 mSelectAll...........................................76 mSelectCount ....................................102 mSetCriteria ..................95, 96, 100, 102 mSetField ..............................88, 89, 103 mSetPassword ...................................114 mSetProperty.....................................115 CharacterSet ..................................117 Delimiters......................................121 ErrorLog........................................119 MaxLoggedErrors .........................119 MinWordLength............................121 Months ..........................................118 ProgressIndicator ..................112, 116 ProgressIndicator.Message............116 ShortMonths..................................118 ShortWeekDays.............................119 StopWords ....................................122 String.............................................121 Verbose .........................................117 VirtualCR ......................................116 Weekdays ......................................118 mUnBindField.....................................91 mUpdateBoundFields..........................93 mUpdateRecord ..................................89 mXtraVersion....................................114 new....................................21, 23, 50, 74 V12Error ...........................................105 V12Status..........................................105 Mode .......................................................50 Clone .................................................110 Multiple Instances .................................134 O Operators searching.................................97 P Packing a Database file .........................110 Parameters...............................................23 Password .........................................50, 114 Pathnames ...............................................23 Portability Issues ...................................136
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-98
Progress Indicator ......................... 112, 116 Properties Custom.............................................. 122 of Databases.............................. 112, 115 Predefined......................................... 116 String ................................................ 120 Q Queries Boolean............................................... 35 Complex.............................................. 35 Simple................................................. 34 R RAM buffer ............................................ 46 Reading a record..................................... 80 Reading an entire selection ..................... 80 Reading data ........................................... 79 Reading fields of type date ......................................... 79 of type float......................................... 79 of type integer ..................................... 79 of type media ...................................... 88 of type string ....................................... 79 Record Delimiter .................................... 80 Relational database ................................. 30 RTF....................................................... 102 S Search Criteria Complex...................................... 35, 100 Contains .............................................. 99 Simple........................................... 34, 95 Starts ................................................... 99 WordEquals ...................................... 100 WordStarts.......................................... 99 Selection ................................................. 75 Records ............................................... 76 Size ................................................... 102 Shortest word (Full-Index).................... 121 ShowXlib ................................................ 23 Sorting Styled Text Fields .................... 104 Stop Words ............................................. 30 String ............................................ 109, 163
String Types (Custom) ..........163, 165, 169 System Requirements ..............................15 T TAB-delimited file ..................................39 Testing ..................................................135 Tool...................................................49, 63 Typecasting .............................................33 U Using A V12-DBE Database .........................73 Xtra Instances......................................22 V V12BeginProgress (handler).................113 V12-DBE Tool..................................49, 63 V12EndProgress (handler) ....................113 V12Error (method)................................105 V12Progress (handler) ..........................113 V12Status (method) ..............................105 Virtual CR.......................................40, 116 W Warnings .......................................106, 200 What is ? A database...........................................27 A field .................................................27 A record ..............................................27 A search criterion ................................34 A selection...........................................34 A table.................................................27 The current record...............................34 Writing Data............................................89 of type Date.........................................90 of type Float ........................................89 of type Integer .....................................89 of type Media ......................................90 of type String.......................................89 X XML........................................................69
V12-DBE for Macromedia Director - User Manual Integration New Media, Inc. 1995-98