Solved

Required field data in layout in Filemaker Pro 10

Posted on 2016-10-06
6
35 Views
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?
0
Comment
Question by:maryj152
  • 3
  • 3
6 Comments
 
LVL 24

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.

Screen-Shot-2016-10-06-at-Oct-6---3..png
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.
0
 

Author Comment

by:maryj152
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?
fpMessage.gif
0
 
LVL 24

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
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:maryj152
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?
0
 
LVL 24

Accepted Solution

by:
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.
0
 

Author Closing Comment

by:maryj152
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.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now