Required field data in layout in Filemaker Pro 10

Posted on 2016-10-06
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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.


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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

856 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