From our experience with the Codifi projects we know there are many things to consider when you’re designing a database that’s going to be deployed in the field. Data entry by the user should be kept in mind – as a developer you need to think through all the ways that your users will want to input data, and when and if those conditions are appropriate for your solution. The easiest way to solve this, thanks to FileMaker 13, is the “hide object when” function found in the Data Inspector.

Hide Object - Filemaker 13

With this tool (accessed in the Data Inspector in FileMaker’s Layout Mode) you can specify the exact conditions users can see and interact with all the data fields in your solution, using a simple bit of scripting. As Matt Petrowsky of FileMaker Magazine points out, using a simple

not IsEmpty (field)

calculation pointed to the specific field will actually hide the field in question if there is not data present in it — which brings up other points of maximizing layout space and data presentation that will be covered in future blog posts.

For other solutions that incorporate an ‘editing’ capability or button for their layouts, using invisible layout object to effectively ‘block’ users from entering field data when not in ‘edit’ mode is a very effective way to prevent accidental data entry in the field as well, just apply the script to the invisible layout object instead of the field itself.

An example of this technique is demonstrated below:

Limit data entry errors in Filemaker 13

Make sure in your Edit script there are 2 parameters, (1 and 0) for editing mode enabled and disabled respectively. Now when creating your layout object (the red box), it’s important to add the correct scripting to Hide the object, in this case:

Layout::gEdit=1 or not IsEmpty (Layout::Fieldname)

Now this scripting firstly makes sure that the red box shows when ‘edit’ mode is NOT selected in the database (you wouldn’t want that box to display when users are edit and inputting data).

Limit data entry errors in Filemaker 13

And when editing mode is enabled, the red box disappears and data is able to be entered:

Limit data entry errors in Filemaker 13

But what about after you enter data, you certainly don’t want that red box obscuring your or the user’s great work! That’s what the second part of the hidden object script does:

not IsEmpty (Layout::Fieldname)

Limit data entry errors in Filemaker 13

Limit data entry errors in Filemaker 13

ensuring that the box only displays itself when the field in question (Locus) has no data present in it.

So there you have it, using Hide Object When to prohibit access to the underlying fields and only ‘displaying’ when the fields have no data, or when editing mode has not been enabled on the record you’re browsing.

Go forth and protect your data!

Author: Michael Ashley

Feb 23, 2015 | Tips | 0 comments

More Articles

Five Lessons from Hiring a Freelancer Online

Freelancer Developers can be an affordable option for small teams or projects with a tight budget. CoDA tested out Upwork, an online hiring platform, last year and worked with a few freelancers, some better than others! Here are 5 things we learned and how you can get the most for your project on a budget of any size.

read more

Moana: Ancient Folklore Goes Digital

For the ancient Polynesians, folklore was shared by word of mouth, today the most popular platform for telling stories are movies. Moana, Walt Disney Studios’ latest film, tells the story of a young girl raised to become chief of her people who comes to discover she...

read more