A FMT Preferred FileMaker Consultant - Developer
Log in
Hot & Trending on FMT

Making Creation of Records in a Portal More User Friendly

Making Creation of Records in a Portal More User Friendly - Daniel Wood Making Creation of Records in a Portal More User Friendly - Daniel Wood

FileMaker provides us with the ability to create related records directly from a portal. This is a great and easy way to generate records without the need to script the process, and for that reason it is a popular technique among both new users and Developers alike.

In this example I have a simple relationship setup between customers and contacts. A customer can have many contacts. In order to create records through a portal, the option Allow creation of records in this table via this relationship must be checked on the portal side of the realtionship.

Creation of related records works because FileMaker automatically populates fields on the new record that are in the relationship. So in the example above, the field Customer ID will be automatically set on the new record created, thus making it a related record of the current Customer.

Relationship Setup

However, with great power comes great user interface responsibility :) The default interface is not the most intuitive of designs:

Default Interface

But, with a little bit of conditional formatting, you can make this interface more presentable for users.

FileMaker places a blank row as the last row for creation of records. But to the average user, this might just look like a blank record. It would be nice to show the user that this row is for adding a new record. There are numerous ways to do this, but here is a simple method:

Label on the Last Row

Here, I have placed a label on the last row which tells the user to enter the name of a new contact into this row. Because everything you place inside a portal will potentially show on every row, we need to hide this label on every row except the last row, here's how:

First, place the label inside the portal, ensuring it is placed behind the field.

Next, make the field transparent fill, allowing you to see the label behind.

Now, add a conditional formatting clause to the field. Remember we want to hide the label, so filling the field with a solid colour such as white, will accomplish this.

We wish for every row to fill the field white except for the last row. In order to achieve this, we need to find a distinction between the last row, and all the others. Fortunately there is one - the last row is not actually a record at all. You can tell a record from a non-record by whether or not the row has a primary key value. For contacts - our primary key field is the Contact ID field. Primary key fields should always have a value in them, so we can test whether our row has a value for the Primary Key - if it doesn't then the row must not be a record at all:

Conditional Formatting Setup

The condional formatting evaluates true for any row that contains an actual record, and false for our special row used for the creation of a record.

Deletion of Records

Finally, using the same idea for the label, we can make deletion of records more intuitive. Consider a simple "X" piece of text in the portal which represents deletion of a portal row:

Delete Icon in Portal

Again, there is no point in showing the X on our special portal row, because we can't delete it - it isn't even a record!

We can however use conditional formatting to hide the X - this time, we can set it's text colour to the same background colour as the portal

Conditional Formatting for Delete Label

This time, we wish to apply the formatting on just the blank row only, so we do this if the primary key field is Empty.

Delete Cross Formatted

The end result is quite nice. In this situation I have attached the "Delete Portal Row" script step to the X. However you should note that if you choose to run a script to handle your record deletion, it is always a good idea to check whether the row you have chosen is an actual record, or the special portal creation record, ie:

If [ isEmpty ( Contacts::Contact ID ) ]
Exit Script []
End If

This block of text should go as the first thing in your script. By doing so, you script will never run it's steps if the user happens to try to delete the special row. Certain actions within your script can in fact create a record rather than delete it ! For example, if your script tries to set a field on the blank row, this will create a record right away. to avoid all issues, do your existence check as the very first step.

Example File

Please find attached an example file. This file was used for all the screenshots in this article, and is fully commented to help you fully understand what is going on in the file.

Download Example File