Home > Articles

This chapter is from the book

This chapter is from the book

Working with Field Types

One of the most important aspects of understanding FileMaker Pro is understanding field types, how they're different from one another, and how to use them effectively.

Simply stated, field types identify what kind of information each field of your database is expected to hold. A person's name is text, the dollar amount for a transaction is a number, a birthday is a date, and so on. Generally it should be quite clear to you what each needs to be.

Field types determine what types of operations can be performed on a given field, what information a field can accept, and the rules by which a field is sorted. It's the combination of a proper identifying field name and a data type definition that gives a database its context and meaning.

Text

Text fields are the most free-form of the field types. Users can enter any range of information in them, including carriage returns, and there's no expectation of what form or sort of information a text field will hold. The only requirement is that it be character based—in other words, you can't place a picture in a text field. A text field can store up to 2GB of information, limited by RAM and hard drive space, of course, and indexes up to approximately 100 characters, depending on what language you're using. We'll cover indexing in more depth later in the chapter. For now, simply remember that each field type has different limits and approaches on indexing.

Number

Number fields can store values from 10-400 up to 10400, and negative values in the same range. FileMaker Pro indexes the first 400 significant digits (numbers, decimal points, or signs) of a number field, ignoring letters and other symbols. Number fields can accept text (although not carriage returns), but any text in a numeric field is ignored. FileMaker interprets 12ax3 as 123 if you enter it into a numeric field, for example.

Something to keep in mind with FileMaker Pro: A number field can be expressed as a Boolean. A Boolean value is either true or false, and is often used to test the condition of something. A zero or null value in a number field is treated as false in the Boolean sense; any other data is treated as true. You will often run across number fields being used to store Boolean values.

The primary distinction between a number field and a text field lies in how they're sorted: A text field sorts 1, 10, 2, 20, 3, 4, 5, whereas a number field sorts 1, 2, 3, 4, 5, 10, 20.

Date

Date fields accept Gregorian calendar dates only. FileMaker Pro honors whatever date formatting your country follows by taking the standard your operating system uses at the time a new file is created. Date formats—the order of year, month, and day—are common for a given file. Although it's possible to change the way dates are displayed, it is this basic ordering that is fixed at the time of file creation.

Dates in FileMaker Pro are internally stored as the number of days since 01/01/0001. January 1, 2004, for instance, is 731581. If you need to compare dates or perform any functions on them, remember that behind the scenes they're really just numbers. This feature is actually quite handy. To switch a date to a week prior, all you need to do is subtract seven.

Date fields can store values from January 1, 0001, to December 31, 4000.

 

If your fields are sorting or displaying oddly, refer to "Mismatched Data Types" in the "Troubleshooting" section at the end of this chapter.

Time

Time fields hold HH:MM:SS.ddd information. Notice that a decimal may be added to the end. Also useful: If a user enters 25:00, FileMaker Pro rightly interprets this as 1:00 a.m. 99:30 becomes 3:30 a.m. The clock simply keeps rolling over. This behavior is useful when you need to add, say, 30 hours to a time, and don't want to be bothered with calculating what hour that becomes. Likewise, if you are doing data entry in a time-tracking system and don't want to create two entries for a case in which you worked from 2:00 p.m. until 2:00 a.m. on Monday (really Tuesday), entering 26:00 for the ending time in your system rightly calculates to 12 hours.

As in dates, FileMaker Pro stores time internally as the number of seconds from 12:00:00 on the current day. 1 is 12:00:01, and 43200 is 12:00 p.m. As with date formats, your time format is established during the creation of the file, based on system operating system settings.

The maximum time value you can store in a FileMaker Pro time field is 2,147,483,647. That's a lot of time.

Timestamp

The timestamp data type combines date and time information. It appears as a field with both date and time values, separated by a space: 1/1/2004 12:00:00. As in date and time formats, timestamps are also stored as numbers: the count of seconds from 1/1/0001 00:00:00. Be prepared to work with large numbers when using this field type. Timestamps are an important aid to interoperability with other databases (such as those powered by the SQL language), which often store date and time information in a single timestamp field.

The maximum value of a timestamp is 12/31/4000 11:59:59.999999 p.m. or 126,227,764,799.999999 seconds.

Container

Container fields are different from the five already mentioned: They store binary information. Information is often inserted into container fields rather than being entered manually (you can copy and paste). You can place any sort of digital document in your database, limited again by the practical limits of your computer hardware, up to 4GB.

Container fields also support displaying/playing three native types of media: pictures, QuickTime movies, and sounds. Refer to the FileMaker help system for supported formats, but most common image formats are included...as well as some you won't expect. For example, by using QuickTime, it's possible to display and play a Macromedia Flash 5 .swf file.

Last, on Windows, a wide range of OLE objects are supported, including Microsoft Excel documents, PDF, and more.

There's one important thing to remember about using container fields: Either you can store the file or media in FileMaker itself—requiring disk space—or you can simply store a path reference to the file instead. If you choose to store just a reference to the file, FileMaker Pro, somewhat like a web browser, displays the image or file icon as necessary, but does not hold the actual document itself. A nice feature of storing references is that you can then double-click documents in your container fields to launch them in your operating system.

Calculation

Calculation fields evaluate formulas and display the requisite results. When you create a calculation field, the Specify Calculation dialog, shown in Figure 3.2, opens.

03fig02.jpg

Figure 3.2 Calculations form an essential pillar of FileMaker Pro development.

arrow.gif

Be sure to refer to FileMaker Pro's online help or our companion book, FileMaker 8 Scripts and Functions Desk Reference, for a complete list of functions. The book presents every function in FileMaker along with discussion and examples.

The features of the Specify Calculation dialog box include the following:

  • Field list— Select fields to include in your calculation from the list below the table menu. Use the drop-down menu to change from table to table. Note that double-clicking inserts a field into your calculation where your cursor currently sits.
  • Operators— Use these buttons to insert math and special operators.
  • Function list— Just below the View drop-down menu is a list of functions. Here you're able to scroll through all of FileMaker Pro's various functions and then double-click to insert. It's a good idea to start here to get your syntax correct.The menu above enables you to filter your list by category to show the functions you need.
  • Expression text box— This is where you assemble your actual formula or expression. This is a simple text entry area: If you want, work in a text editor and paste calculations here.
  • Calculation Result Is list— Calculations return varying information, depending on what data/field type is required. If you want the field to be sortable by alphabet, set the return data type to Text. If you have a field returning, say, a price, set the type to Number.

Examples of calculations include the following:

  • 3 + 4 always displays its result of 7.
  • Sale + Tax displays the sum of two fields named Sale and Tax.
  • Position ( Notes; "a"; 1; 1 ) returns a numeric position, starting from the first character in the field Notes, for the first "a" found.
  • IsEmpty ( MyField ) returns a zero or one (Boolean) depending on whether MyField has a value in it, including zero. If a zero is entered, the field is technically not empty. Only a null value is considered empty.
  • If ( MyDate > 900; "yes" ; "no" ) displays a yes for dates entered in MyDate greater than 6/19/0003; otherwise, it displays no. (Remember that you've just tested for the number of days past 1/1/0001.)

Calculations are fundamental to FileMaker programming, and it's worth your while to master them fully.

arrow.gif

For more detail on calculations, see Chapter 8, "Getting Started with Calculations," p. 217, and Chapter 14, "Advanced Calculation Techniques," p. 391.

 

If your calculation formula looks correct, but FileMaker is returning an odd result or ?, refer to "Mismatched Calculation Results" in the "Troubleshooting" section at the end of this chapter.

Summary

Summary fields allow you to evaluate information across a found set of records. Sum, Average, Max, Min, and Count are among the summaries you can establish. Don't forget that they apply to found sets: Change your found set, and the result changes.

For example, say you have a table called Transaction, which contains Transaction_Date and Transaction_Amount fields. You can then define and place on a layout a summary field to total the Transaction_Amount field. The summary field adds the values of the Transaction_Amount field for whatever set of records is currently active. If you perform a find, by date, on 10/1/2006–10/31/2006, your found set will be all the transactions for the month of October, and the summary field will show just the aggregate monthly transaction amount. Perform a different find request and your total changes, reflecting the aggregate of the new found set.

Table 3.1 contains a list of summary field functions.

Table 3.1. Summary Field Functions

Function

Summary Behavior

Total of

Adds values from the specified field in your found set. Think of it as a subtotal or grand total from a column of numbers.

 

You may also enable the option to display a running total for your recordset. This then shows a running tally of your total if you place the summary field in the body area of a list.

Average of

Averages the values from the specified field in your found set. The weighted average option enables you to specify a second field to act as a weight factor for calculating the average.

 

The field you choose must be a number or a calculation with a number result.

Count of

Counts the number of records in your found set that have valid data in the specified field. For example, if 18 of the 20 current found records have data, your summary field will display 18.

 

A running count functions similarly to a running total: It displays the incremented count of each record in your found set.

Minimum

Returns the lowest number, date, time, or timestamp in a given found set from the referenced field.

Maximum

Returns the highest number, date, time, or timestamp in a given found set from the referenced field.

Standard Deviation of

Determines how widely the values in the referenced field differ. Returns the standard deviation from the mean of the values in your found set.

 

The standard deviation formula is n–1 weighted, following the normal standard deviation.

 

Standard deviation comes in two flavors; to perform a biased or n–0 evaluation, select the By Population option.

Fraction of Total of

Returns the ratio of a total for which a given record (or set of records, when the field is placed in a subsummary part) is responsible. For example, you can track what percentage of sales are attributable to a given person.

 

The subtotaled option enables you to specify a second field by which to group your data.

When you create a summary field, the Options for Summary Field dialog opens, prompting you to choose the function you want to use and the field for which you want a summary (see Figure 3.3).

03fig03.jpg

Figure 3.3 Summary fields are useful for performing functions across sets of records, but use them with care. They can increase the time it takes to load any given layout.

It's generally a good idea to place summary fields on their own layouts so that a user deliberately chooses to have them evaluate a found set.

In Browse mode a summary field will evaluate your found set and display a result when it is actually visible on a layout. For example, if a summary field is below the visible portion of a layout, it will display information only when the user scrolls to that portion of the window.

Summary fields will evaluate a found set for a given layout whenever you enter Preview mode.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020