how to set criteria on add record

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

I would like to stop anyone from starting a new time card if they have not clocked out on the first one

Photo of Jason


  • 0 Points

Posted 4 years ago

  • 0
  • 1
Photo of Jack

Jack, Champion

  • 50 Points
Hi Jason,

There are a few ways to do this.

Crude Way:

I am going to assume that the time card is linked to an individual or team. You need to create a count of un clocked out time cards (summary field in your table relationship). Then pass this value back to the timecard table as a lookup field.

When the user selects the team or themselves, you can use the form rule to hide all the sections of your time card form and display a warning to the user to tell them to sign out of their timecard, you can even add a button to take them to that time card by creating another summary field max record id and the filter would be where status is equal to unclocked (if you create a status field that looks at this. Then pass this field to the time card table as a lookup and create a formula url field which uses a formula like URLRoot() &"db/"& Dbid () & "?a=er&rid=" & [Max Record ID#] 

Complicated way

This involves ensuring the user can only add a time card from their team or individual record. This would mean that their team or individual record would be selected (as you would be coming from the parent to the child record.

You could edit the add button with an if formula to look to see if there are outstanding records and take them in to edit that record rather than create a new one.

There are lots of ways to do this so it really is up to you.
I would do this:

1. Set the UI interface on the Role to hide the Add button. That will suppress the native Green color ADD TimeCard button.

2. Explain to users that the way they will Add To Add a TimeCard is to launch off their Employee record.  Presumably you have a relationship where 1 EE has many TimeCards.

3. Make a summary field on the relationships between Employees and timecards and count the # of open time cards. (ie not clocked out)

4. Set a form rule on your form


Where # time cards not clocked out >0


Hide Add Timecard.