FMStudio Complete Guide Chapter 3

From FMWebschool Reference

Jump to: navigation, search

Contents

Chapter 3. Performing a Find-All and Displaying a Table of Results

When you want to do any type of FileMaker search, you will need to start with a recordset. The recordset can be found under the Applications panel and the ‘Server Behaviors' tab. The recordset is usually the first item available in the drop down list of Server Behaviors.


image1.png

Image 3 – 1: Recordsets are found under Server Behaviors


When you select Recordset from the list, a 'Find Recordset' window will open asking you for details regarding the specific search.


image2.png

Image 3 – 2: The Find (Recordset) dialogue window


Getting Started with Recordsets

When you work in FileMaker, you are usually working with a found set of records. FMStudio works the same way. The first thing you will usually do is to create a Recordset, or a ‘found group of records’ to work with. The next few steps will show you how to create the recordset and then go into a more detailed explanation about Recordsets.

  1. The first step is to enter the name. The name should be alphanumeric, with no spaces and should not begin with a digit. In this example we will name it 'photographs'.
  2. Under connections, select the database from which the information will be used. And then the layout that contains the information that you want to display. In this example we will be using the 'photos' layout.


image3.png

Image 3 – 3. Recordset Dialog with Connection and Layout Selected


  1. Next is the "Add Criterion" section, this section is simply asking you, what find criterion you want to use. This is just like a search within FileMaker, you have all of your fields on a layout, and you can enter a number of them into a search. In this example we will be performing a "findall". The other 'find' criterion will be covered in detail later in this book. But currently, for a findall, you can select any field. Select ‘photoID’.
  2. Once the selection has been made, we will need to click the 'Add' button. The 'Variable Selector' window will open.
  3. Under Type select 'Constant' search, and for the value use an asterisk. The ‘*' is a wildcard in FileMaker matching 0 or more characters – essentially all of the values inside this field.

image4.png

Image 3 – 4: Set the Type to Constant, and the value to ‘ * ‘ this will allow for a wildcard search.


  1. The next option is how many records per page to display. If you have many records and will be implementing "paging", this is a good feature to adjust to the size of the page that you want. Paging simply allows you to decide how many records per page you wish to display. Most websites display paging as numerical values at the bottom of the page with a previous or next link beside them.
  2. The last option is 'Redirect on Error'. This should point to an error page that we will be creating later on to display any error messages that may come up. Click the 'OK' button once all of the information has been entered.

image5.png

Image 3 – 5: Completed Recordset named ‘photographs’ with a redirect to the ‘error.php’ page.


Once the recordset is applied to the page, it is time to display the results in a table. Just like in FileMaker, you have a found set of records; that can easily display those records on a layout. There are many different views in FileMaker that you can use to display records, list view, table view, and form view. There are also many different ways to display results in FMStudio.

The great thing about FMStudio is that you can customize the look and feel of your results. As we progress through this book, this will be covered in greater detail. For now, we will stick with simple table development and concentrate on learning the core basics of FMStudio.

In this example we are going to build a simple table built by an FMStudio wizard. You can find a number of wizards under Server Behaviors > Wizards. We will use the Dynamic Table wizard.


image6.png

Image 3 – 6: Create a simple table with the Dynamic Table wizard. Server Behaviors > Wizards > Dynamic Table


Note: Before applying a table, form or any dynamic element, click into your design view and make sure you have a blinking cursor inside the work area of your page. Otherwise, the table will be inserted in the invisible portion of the page, and that is never fun.


Creating a simple table with the Dynamic Table Wizard

Once you select the 'Dynamic Table' wizard, a 'Dynamic Table' dialogue box will appear.

image7.png

Image 3 – 7: Dynamic Table dialogue window


  1. The first field asks for the table name. Name the table 'results'.
  2. Next, select the recordset the information will be coming from. This will be the ‘photographs’ recordset that we just created earlier in the chapter.
  3. The next options in the table set the table width and add colors to the table’s border, caption cell and data cell. Let’s set the width to 400 and leave the colors to their default values.
  4. Next, under the ‘Table Fields’ section, select the fields ‘photoName’ and ‘photoDescription’ from the drop down list. Notice under the Column Caption heading, you can give the field a Label. The Label is a descriptive text element for the field and does not affect the content of the field in any way. Many times we create fields in FileMaker that are not very descriptive. Using labeling helps individuals better understand the data that is being displayed. I will take a few moments and make label changes to the field 'photoName' by changing the caption to 'Photo', and the 'photoDescription' field will be given a caption of 'Description'.

image8.png

Image 3 – 8: The completed Dynamic Table with the fields ‘photoName’ given a label of ‘Photo’ and the field ‘photoDescription’ given the label ‘Description’.


  1. Next, click 'OK' and the table will appear on your page. Yes, I know, it does not immediately appear to be all that impressive. But this page will actually display numerous records when previewed live. The little grey ‘Repeat-photographs’ tab at the top of the table will allow this table to display all of the records in the found set. Now aren’t you glad that the Recordset was limited to display 10 records at a time?

image9.png

Image 3 – 9: Dynamic table with ‘Repeat-photographs’ region added.


  1. Once the table has been applied, save your page. Matter fact, make that a habit. While working in Dreamweaver, save your pages every time you make a major change. I habitually hit the save button as I am working.
  1. Once the page has been saved, it can be viewed in a browser. You can do this by selecting File > Preview in Browser and then select your browser, or from the task bar, you can select the 'Earth' icon and select your browser from the list below.

image10.png

Image 3 – 10: Select a browser to preview your page.


image11.png

Image 3 – 11: Another option is to select File > Preview in Browser and then select your browser. You can also edit your browser list by selecting – Edit Browser List.


Note: If you use the File > Preview option you can set up numerous browsers as well as your default browser. Why would it be important to set up numerous browsers? Sometimes browsers display pages differently, what might show up perfectly fine in FireFox may not look perfect in Internet Explorer. Multiple browsers give you the opportunity to make subtle adjustments so your pages look great across all browsers.

image12.png

Image 3 – 12: Edit your browsers under the ‘Preview in Browser’ category.


As you can see from the screenshot below, the first 10 records are displayed with the bolded captions as the table headers. In this chapter we created a recordset using a 'findall' and displayed the results in a table.

image13.png

Image 3 – 13: Table showing the first 10 records. Notice the captions reflect the changes I made when setting up the fields in the dynamic table.


See Also

Personal tools