When the solution matters

Tips...

Registration Documentation Knowledgebase Seminars / Training Technical Support Partner Central

FileMaker Pro to 4th Dimension Quickstart Guide

Nomenclature and Concepts

The following section describes the many conceptual similarities and differences between FileMaker Pro and 4th Dimension. It is important to understand that while many of the concepts are similar, there are some fundamental differences between the two products. Understanding these differences early on can help a lot in learning 4th Dimension.

Code / Coding - Throughout this document, we'll be using the term "code" and "coding" to describe the process of development as well as the finished product. In FileMaker Pro, you code in a variety of ways. This is done through different kinds of dialogs such as ScriptMaker, the Define Calculation dialog, Field Entry and Validation Options, Layout Options, etc. These all constitute coding in FileMaker Pro. In 4th Dimension, coding is also done through dialogs such as Table Definition, Field Definition, Form (layout) choices, etc. but you also code using the Method Editor. The 4th Dimension Method Editor is roughly analogous to ScriptMaker. Like ScriptMaker, you can choose the steps from a list, but you also have the option of typing directly into an editable text area. The term "code" will be used irrespective of the product to include all of these concepts.

Modes vs. Environments - FileMaker Pro has several Modes: Browse, Find, Layout and Preview. These Modes determine what you can do at that moment, from designing the database to searching and viewing record data. In 4th Dimension, these are called Environments, and 4th Dimension has three of them: the Design Environment, User Environment, and Custom Menus Environment (oftentimes simply referred to as the Custom Environment).

The Design Environment is a lot like Layout Mode. It's where you build layouts. But it also includes the 4th Dimension equivalent of ScriptMaker, because it's where you code. It incorporates the concepts of Define Fields, Define Relationships, and Define Value Lists. Basically, all of the structure definition is performed in the Design Environment.

The User Environment corresponds with Browse Mode. It's where you view and edit record data. It's where the end user interacts with the database using 4th Dimension's built-in tools. It is possible to develop a database and deploy it for use entirely in the User Environment, with a minimum of coding. When deployed this way, a 4th Dimension database would behave much the same as a FileMaker Pro database does.

The Custom Menus Environment has no real counterpart in FileMaker Pro. In 4th Dimension, you can build your database into a true custom application, with its own menus, its own splash screen, and its own application name. This is done in the Custom Menus Environment, and it is used more often than the User Environment, because many developers who use 4th Dimension like the complete control it offers.

You can liken it to the two basic ways that the Web Companion can be used in FileMaker Pro: if the User Environment is equivalent to Instant Web Publishing, then the Custom Menus Environment is equivalent to Custom Web Publishing. Where the User Environment is fast to deploy but generic in appearance and user interface (for example, the menus are already defined for you like in FileMaker Pro), the Custom Menus Environment is entirely customisable but requires more work. But the choice is yours. By producing a solution in the Custom Menus Environment, it is possible to make your database look like your application, without any hint that it was created using 4th Dimension.

You'll notice that two of FileMaker Pro's modes don't have direct counterparts among 4th Dimension's environments. First, there's Find Mode. In 4th Dimension, you can perform searches (called Queries) in the same way as you can in FileMaker Pro, by entering find criteria in a "blank" layout and executing the search. In 4th Dimension, this is called Query by Example, or Query by Form. It works a lot like FileMaker Pro's Find mode, but isn't quite as powerful. For instance, FileMaker Pro allows you to perform a logical OR search by entering multiple find requests. 4th Dimension's Query by Example does not do this. However, there are so many other ways to find information in 4th Dimension that this will not seem a hindrance.

Most of the time, you wouldn't use Query by Example to perform a search. There are several other, more powerful ways to perform a search in 4th Dimension, such as the Query Editor and corresponding QUERY command. We will discuss this more later.
FileMaker Pro also has Preview Mode, which allows you to see how the database would look if you were to print it now, using the current layout and the current found set. 4th Dimension allows you to Print Preview prior to printing. It works similarly, but does not change the mode of the database. Instead, it is an option during printing. In 4th Dimension, Print Preview will always show you exactly, precisely what the printout will look like, because it uses the print driver to generate the Print Preview.

Tables vs. Files - In FileMaker Pro, you can tell how many files there are in a given solution by looking at the files on disk, or by looking under the Window menu to see which files are open. Each file contains data pertaining to a specific kind of entity, like Invoices or Customers or Products. In most other databases, these are referred to as Tables. In FileMaker Pro, each file on disk contains a single table of data, and contains both the structure (or schema) of the file as well as the data (or records) contained in the file. A relational database solution in FileMaker Pro, therefore, is composed of many separate files on disk.

In 4th Dimension, the structure for all of the tables that comprise a database are contained in a single file on disk, called the Structure file. All of the data contained in the database is contained in a single file called the Data file. Thus, there is a clear separation between the structure and the data in 4th Dimension. Installing a new version of a database is just a matter of swapping out the structure file.

In 4th Dimension, since all the tables are located in the same file, there is never any chance that the database will open the "wrong file" when a given related table is required. All relational references are very explicitly defined. Furthermore, since all the tables reside in the same file, 4th Dimension provides a database Structure Editor where all tables, fields and relations are actively but visually managed. This Structure Editor serves as an interactive real-time ER Diagram or Functional Dependency graph for your database.

Fields - Both FileMaker Pro and 4th Dimension use fields to store their information. In FileMaker Pro, fields are used for data storage, for calculated values and summaries, and for global variables.

4th Dimension supports all of the same basic data types that FileMaker Pro does. But some of the more special use fields (such as Summaries and Global fields) are handled in a different way in 4th Dimension. For example, while FileMaker Pro uses Global Fields to store record independent values, 4th Dimension provides true global variables.

The following chart helps to map the data types in FileMaker Pro with their 4th Dimension equivalents.

FileMaker Pro Fields 4th Dimension Data Types Notes
Text Text, Alpha Text isn't indexed in 4th Dimension
Number Real, Int, LongInt 4th Dimension stores true numeric information, not text. This makes calculations much faster.
Date Date  
Time Time  
(No Equivalent) Boolean Simulated with number fields in FileMaker Pro
Container Picture, BLOB (Binary Large OBject) BLOB can contain any type of information including binary files (documents)
Repeating Fields Subtable Subtable is not exactly analogous to repeating fields, but allows similar functionality

Calculations are handled differently in 4th Dimension than they are in FileMaker Pro. In FileMaker Pro, a calculation is used whenever a dynamic or derived value is needed. These calculations can be defined as Calculation Fields (either stored or unstored), as Auto-Entered calculation options defined on regular fields, or as scripted Set Field operations. The model is similar to a spreadsheet. You define the calculation in the ‘cell’ where the answer will show up. It is up to the application to decide when one of the dependent values has changed and recalculate the field's value.

In 4th Dimension, calculations are handled with a combination of either a regular field or a variable (see below), plus additional code to express the formula. You control when the formula is calculated. In FileMaker Pro terms, it's as if you didn't have calculation fields, and instead used Set Field whenever a value needed to be automatically set by the database. However, that's not really a fair comparison due to the limitations of FileMaker Pro's ScriptMaker, and the limited way in which scripts can be executed in FileMaker Pro. For example, you can create your own function in 4th Dimension and then use it anywhere you like. With 4th Dimension, you have much more control over precisely when a calculation or other piece of code executes.

The following chart illustrates the FileMaker Pro calculation types and roughly corresponding 4th Dimension equivalents.

FileMaker Pro Fields 4th Dimension Data Types Notes
Stored Calculation Field Code plus Field Evaluated results stored in a field
Unstored Calculation Field Code plus Variable Evaluated results temporarily stored in a variable, which can be placed on a layout and displayed in a variety of formats (see form objects below)
Summary Field Code plus Field or Variable Summary values can be stored in 4th Dimension since any calculation can be assigned to a field. This can be a performance benefit since you don’t need to re-calculate values based on items that haven’t changed

In FileMaker Pro, stored calculation fields evaluate whenever a referenced value changes. Unstored calculation and Summary fields evaluate their contents at the time they are drawn onscreen. As the developer, you have little or no control over deciding when a calculation or summary result will re-evaluate. Thus, you have to take special care not to accidentally navigate to a summary layout, because it may take a long time for FileMaker Pro to evaluate the summary data when you get there. In 4th Dimension, the developer has complete control over the evaluation of calculated results. You decide when they calculate. You decide where they are stored. You even have multiple ways to calculate values.

For example, in FileMaker Pro you might define a calculation field in an Invoice's line item called "Extended Price", which multiplies the Quantity by the Price. The formula might look something like this:

Extended Price (Calculation, Number Result) = Quantity * Price

This formula would be part of the field definition for the Extended Price field.
In 4th Dimension, you might code this to store the Extended Price value in a Real (number) field called "Extended Price". The code would be attached to both the Quantity and Price fields, so that it would execute whenever either of them was changed, and might look like this:

[Line Items]Extended Price := [Line Items]Quantity * [Line Items]Price

In FileMaker Pro, unstored calculation fields basically play the role of record-level variables. That is, they contain unstored (thus temporary) results for a given record. Global fields play the role of file-level variables, in that they store information that does not belong to any given record, but rather to the table as a whole. In 4th Dimension, these roles are handled by Variables, which will be discussed a little later in this document.

Views - In FileMaker Pro, in Browse mode, you can view the current layout in one of three different ways: View as Form, View as List, and View as Table. The option you select determines the number of records you can see on the screen at once, depending on the size of the current layout. As long as the end user has the privileges to do so, they can switch any layout from Form view to List view, and the layout's function (data input vs. output) will change accordingly.

In 4th Dimension, layouts are called Forms. Each table has one designated Input Form and one designated Output Form associated with it. The current Output Form is used for listing tabular data on screen and it behaves much like a layout set to "View As List" in FileMaker Pro. The current Input Form is used for data entry or for viewing a record's details, and behaves like a layout set to "View As Form" in FileMaker Pro, that is, it displays one record at a time. In FileMaker Pro, you switch between these views by switching forms. In 4th Dimension, when you double-click a record in the output form, it opens the input form. Closing the input form bring you back to the output form automatically.

FileMaker Pro has a third View, called View As Table. This function is unique to FileMaker Pro, and causes the database to display its data in a spreadsheet-like interface composed of columns and rows. 4th Dimension has no direct equivalent to this function, though standard output forms can be made to look very much like Table view. In 4th Dimension, it is very easy for an output form to appear as a grid of rows with resizable columns.

Current Found Set vs. Current Selection - In FileMaker Pro, the set of records that result from any Find is called the Current Found Set. The corresponding concept in 4th Dimension is called the Current Selection. In FileMaker Pro, there can only be one Current Found Set per file per user. 4th Dimension is similar: there is only 1 Current Selection per table, per process (see processes later in this document for more information). However, 4th Dimension has a concept that has no equivalent in FileMaker Pro, called the User Set.

In 4th Dimension, you can highlight multiple records within the Current Selection. The currently highlighted records are called the User Set and 4th Dimension allows you to perform operations on the User Set without affecting the entire Current Selection. For example, you can highlight several records and then reduce the current selection to just the highlighted ones.

Current Record - In both products, there is only one currently active record per file/table. This is the record that is currently designated for data entry. When looping through records in code, this is the currently designated record for getting or setting field values. 4th Dimension and FileMaker Pro are very similar in this concept.

In FileMaker Pro, there are actually many different ways to isolate the Current Found Set, including performing a Find, using a Relationship to Go To Related Record (via script step), performing an Import, and Omitting records in Browse Mode. 4th Dimension also has many ways to isolate the Current Selection, including Query by Form/Example, using the Query Editor for ad hoc searches, highlighting records and choosing ‘Show Subset’, Importing, as well as a multitude of ways in code.

There are many times when you need to be able to isolate records based on complex criteria without performing a Find. For instance, you may need to isolate all of a particular Customer's overdue Invoices with a status of "Open". In FileMaker Pro, you could either perform a Find in Invoices to accomplish this, or more commonly, you might create a special relationship based upon a calculation field in order to perform a Go To Related Record script step at the touch of a button. Such special relationships are very useful in FileMaker Pro, because they are one of the only ways to perform complex navigation of this kind. However, defining new special relationships on the fly after a solution is deployed requires design-level access to the database. This can be difficult to obtain in a production environment.

In 4th Dimension, you do not need to define a relation in order to isolate a Current Selection in another table. 4th Dimension's Query Editor allows for powerful, ad hoc searches across tables, and it does not require design-level access to use. It is also available with a single command in the Custom Environment.

Relationships vs. Relations - In FileMaker Pro, when you want to see data from another file, you define a Relationship. In 4th Dimension, relationships are called Relations, but there are some fundamental differences between FileMaker Pro's relationships and 4th Dimension's relations.

In FileMaker Pro, relationships are unidirectional, shallow, and automatic. They are unidirectional because when File A is related to File B, then File B is not automatically related to File A. You need to define a separate relationship in the opposite direction in order for File B to see data from File A. FileMaker Pro's relationships are shallow (that is, they don't span multiple tables) because when File A is related to File B and File B is related to File C, then File A is not related to File C. In FileMaker Pro, a given file can only see data from those files to which it is directly related. Relationships in FileMaker Pro are automatic because FileMaker Pro handles the activation of the relationship in order to use or display related data. For example, whenever a portal is drawn onscreen in Browse Mode, you always see all the related records that will fit in that portal.

4th Dimension's relations are either single- or bi-directional, deep, and can be either automatic or manual in nature. By defining a relation between Table A and Table B, both tables are related to each other and either one can pull data from the other. Relations are deep. When Table A is related to Table B, and Table B is related to Table C, then Table A is by definition related to Table C. There is no need to define calculation fields in Table B in order to display Table C's data in a layout in Table A. 4th Dimension also allows the developer to determine exactly when relations activate, by allowing relations to be either automatic or manual. Manual relations are activated explicitly by the developer through code. Automatic relations are activated in a variety of situations, such as when a portal (called an included form in 4th Dimension) is displaying information from another table. With relations set to Automatic, 4th Dimension transparently takes care of selecting records in related tables in a cascading manner, making generating reports with related data a breeze.

In both FileMaker Pro and 4th Dimension, it's possible to view a list of related records on a layout. In FileMaker Pro, this is done with a Portal, which is a layout object that shows multiple related records at a time. In 4th Dimension, you accomplish this with an Included Form, which serves much the same function. With an Included Form, you specify a list form from the related (many) table to be used to display the related records inside the parent (one) table. This does not have to be the current output form from the same table. The included form acts as a miniature output form from the related file. Double-clicking a record in the included form automatically brings up that record in an input form. This also does not have to be the current input form of the file.

Another important difference between FileMaker Pro's relationships and 4th Dimension's relations is that in FileMaker Pro, relationships do not alter the Current Found Set in the related file. This isn't the case in 4th Dimension. When a 4th Dimension relation operates it changes the current selection in the related file. This becomes evident when you use portals or included forms. In FileMaker Pro, you can view related records from File B in a portal in File A, and File B's found set won't change as a result. In 4th Dimension the relation is separate from the included form. It changes the current selection in the related file apart from the included form. In other words, within a single process, all selections are “live”, meaning that if an included form changes a selection in a related table, then that table’s selection is changed at that instant. If you have more than one process running, then selections in other processes are not affected.

Scripts vs. Methods - Automating a FileMaker Pro database is accomplished by means of scripts, which are defined in ScriptMaker. The equivalent thing in 4th Dimension is the Method Editor. Methods are a series of commands (analogous to script steps). In FileMaker Pro, you code a script by pointing to a specific script step out of a list, and clicking on it to add it to the current script. Options are specified by way of dialog boxes associated with that script step. Not all options are visible from within ScriptMaker. For instance, the Find criteria or the Sort criteria associated with a given script cannot be determined from within ScriptMaker.

In the Method Editor in 4th Dimension, methods are defined by typing into a free-form text area or clicking on lists of commands at the bottom of the window. All of the available functions, tables, fields, forms and your previously defined methods are displayed in lists at the bottom. Options are set by typing directly in the method editor, not by way of dialog boxes that you must navigate through. The method editor provides a host of help in entering your commands including tip help with command definitions including all options (called parameters). You can even compose your methods in an external text editor, and copy/paste the code into the Method Editor.

The Method Editor provides auto indent, color-coding, auto word completion, auto outlining and in general is one of the best coding environments available. Most developers who have worked in the Method Editor prefer it to ScriptMaker's dialog boxes. In addition, 4th Dimension has a multitude of commands, far more than FileMaker Pro.

Scripting in FileMaker Pro is just a structured means of programming. It uses many of the basic concepts found in any other programming environment, such as loops and conditional branching (If/Else/End If constructs). Scripting in FileMaker Pro is about as complex as coding in 4th Dimension, only you are constrained by the interface to pick only the pre-defined script steps that exist within FileMaker Pro. In 4th Dimension, you can create your own functions (as methods) that are dynamically added to the interface and can be called as sub-routines from another method, much like subscripts are called within FileMaker Pro. It's as if you could create your own script steps and calculation functions in FileMaker Pro and have them dynamically added to ScriptMaker as you go.

In FileMaker Pro, scripts can be executed from a number of different places. You can choose a script from the Scripts menu (or use its associated keyboard shortcut, if any), or a script can call another script as a subscript. You can run a script by clicking on a button on a layout, or you can specify that a script run when the file is opened or closed.

In 4th Dimension, you can execute a method in any of those ways, and more. 4th Dimension supports many more events than FileMaker Pro does. Events happen in response to something the user does (On Double Click) or something the user indirectly does (such as the On Load event when a form opens). Some of the events that 4th Dimension supports are On Load, On Unload, On Validate, On Activate, On Deactivate, On Close Box, On Clicked, On Double Clicked, On Keystroke, On Drop, On Timer, On Resize and many more. Also, there are predefined methods that will run when the database is started, when closed, or when a user connects or disconnects. Almost every aspect of user interaction can be scripted.

In FileMaker Pro, if you want to try and implement event-level control like that, you need to use a plug-in, and even then it is not as complete. (See plug-ins later in this document.)

Solutions and Applications - When you have completed a database in FileMaker Pro, it is often referred to as a Solution (whether it's a shrink-wrapped solution intended for resale, or a custom solution built for a specific company). Sometimes, it's referred to as an application, but this is misleading because at no time is the end user ever unaware that they are using FileMaker Pro to access the database.
In 4th Dimension, a completed database is called a solution as well. Similar to FileMaker Pro, 4th Dimension solutions are often referred to as applications, but this has more meaning in 4th Dimension because it is possible for your solution to look completely customised. The end user need never know that the solution was built in 4th Dimension at all.

As previously noted, FileMaker Pro solutions are made up of a number of files on disk. Each file contains a single table, and holds both the structure and the data for that table. Relationships between files are handled as external file references. When FileMaker Pro needs to find a related file, it will use the first file it finds with the same name. It's very possible that FileMaker Pro may use the wrong file to establish the relationship.

In FileMaker Pro, each file has its own independent Access Privileges, so if you wanted to define a new password for your entire solution, you would need to define that password once for each file in the solution. Setting up complex access privileges solution-wide can be very cumbersome in FileMaker Pro. Furthermore, altering the access privileges of a deployed solution requires you to close the solution and open it in Single User mode, since access privileges cannot be accessed from a guest computer.

A 4th Dimension application is held entirely in 2 files on disk. There is a Structure File that contains the entire structure, or schema, of the database – all the table and field definitions, all the methods, all the forms, etc. The second file contains all the data for the solution, including the indices. All table references are contained within the same file; therefore, there is never a worry that 4th Dimension will open the wrong file in order to reconcile a relation or external call. The structure file contains unified access privileges for the entire solution and is much more secure. Adding a password affects the entire solution, and does not need to be done on an individual file-by-file basis. In addition, editing access privileges can be done from a client computer while the solution is in use. Furthermore, 4th Dimension can use encryption for Client to Server communication and can even encrypt data stored in the data file.

Next: Status and Design Functions

Previous: Development Misconceptions


International | Company | Contact 4D | Site Map | Privacy Policy | © 4D UK 1995-2008 | Change font size: [A] [A] [A] | Print this page