Make Excellent Data: Limiting Accidental Data Entry in Filemaker Mobile Solutions




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.

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:

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).

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

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:

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!