[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Required field data in layout in Filemaker Pro 10

Posted on 2016-10-06
Medium Priority
Last Modified: 2016-10-07
I have a layout that is based on the Cataloging table.
One field from Cataloging is "required value" and you can't continue till it is filled in.
Another field (BldgCode) is from the related table Buildings. It is a "required value" in the Buildings table. But on the layout it can be left blank.
There is a field in the Cataloging table (BldgCode). If I make that field a "required value", wont all layouts based on the Cataloging table have to have the field properly filled in. Even if the field is not on the layout. I think I ran into something like this a couple of years ago.
Is there some way to require a field on a layout to be filled in regardless of its table's field's validation status?
Question by:maryj152
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 25

Expert Comment

by:Will Loving
ID: 41832564
If I understand you correctly, you have a Buildings table with a BldgCode field which is a required field in this table, presumably because all buildings must have code, and possibly also because the BldgCode is being used as a Key field in relationships to other tables. The Cataloging table ALSO has a BldgCode field but it's not required for each record. However, on this layout, you want it to require that it be entered before the user can exit the record.

You are correct that if you set Cataloging::BldgCode to be a required field, it will be required for anywhere that the table appears. However, keep in mind that FileMaker's field validations only triggers when you attempt to leave a field or record. The problem with the built-in field validations is that they don't give you much control over when they fire or what messages appear.

There are a couple of ways to solve this:

1) If the layout is being accessed via a script, and the script is paused while the user enters data and then click's a Continue button to resume the script, then you can build a check for a value in the Cataloging::BldgCode field into the script using a Loop and Exit Loop If the field has a value in it. If you don't have a paused script but the user does have to click a button to continue to the next step, you can also build a check on the field into any script that navigates away from the layout. This used to be the only way to do this kind checking easily in FileMaker, but there are much better ways now, so read on...

2) Instead of having to run and pause and script, you can use a Script Trigger that fires when the user exits the record. Go into Layout mode for your layout and then Layouts menu > Layout Setup > Script Triggers tab.

There are a number of events that will trigger a specified script to run when that event occurs. I this case I'd probably use OnRecordCommit or OnLayoutExit. Create a small script (I like to preface Script Trigger scripts with "ST: " so that I can identify them easily) that check for a value in BldgCode and takes the user back to the field if they've left it blank. You can include other options if you want but that's the basic.

3) Another way around this is to use a Popover which gives you complete control over the entry. The user can click something that makes the popover appear with any required fields on it and then you use a script or script trigger to ensure that proper entries have been made.

Author Comment

ID: 41833775
I think this will do what I need but,
When I use the script TSbldgCode onCommit

If [IsEmpty (Cat to Bldg::BldgCode)]
End If

I get the same result as when using  command(s) lines to GoTo Layout and/or Go To Field

The file is attached. It appears the first time when I try to leave the record with the field blank, but it also appears a second time after I have entered data into the field.
When I click yes the second time, I can leave the record without seeing the message a third time.
This will achieve the purpose but will be irritating to the users.
Any way to avoid the second pop-up? Is this because it relates to the table and not the layout?
LVL 25

Expert Comment

by:Will Loving
ID: 41834019
This looks to me like you have set the validation on a field level rather than using a Script Trigger (or perhaps both). The clue being that field level validations will have the Revert Record button.

Turn off the field level validation and ONLY use the Script Trigger. The script should something like:

If [IsEmpty (Cat to Bldg::BldgCode)]
   Show Custom Dialog [ "A Building Code is required." ; "OK" ]
   Go to Field [ Cataloging::BldgCode  ]
End If
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 41834153
That solved that problem. The clone I am testing on didn't match the live db in that area.
What happens now is The message pops up when I leave the record by clicking outside it.
If I click Record>New or Ctrl+N, the message pops up and a new blank record appears. Because there are two table validated fields in the record , when I click the ok for bldgCode the Date required messge appears over the new record.
Would one of the other On Event options take care of this?
LVL 25

Accepted Solution

Will Loving earned 2000 total points
ID: 41834261
You may need to exert greater control over what you allow the end user to do. Use Custom Menus to remove the option to create a New Record using Control-N and then add a New Record button to your layout.

Alternately, and a bit more involved, you can use Custom Menus to create a duplicate of the of the Records menu and then modify the Menu to that "New Record" and Control-N, run a script that checks for completeness before creating a new record. It also gets a bit more complicated because you may not want to functionality on all layouts so you'll have to either assign the Records Custom menu to just that layout or make the attached new Record script take into account which layout it's being run from.

Author Closing Comment

ID: 41834292
I will leave it as is for now. If the process is too irritating maybe it will break some bad habits.

I will look into custom menus later.

Thanks for the great help and information.

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question