Default values for new record based on where created


My app, being designed for scheduling and timesheet management, requires two data entry paths.

Path 1. If a user makes a new timesheet entry (for an unassigned job) he would select his name from the list of workers, then add a new record to the timesheet table. In that case the default needs to have the default date set for today, the start time set at 7:00, end time set at 15:06 and break time as 30 minutes.

Path 2 If the supervisor is building a schedule for the week he would come from the Jobs table, select a date, select an employee and add a new timesheet entry with the selected date and start time with no end or break time.

Is there any way to set defaults (initial values) based on the path used to get to an input form or send a parameter to the form that can be used to set the defaults?


You could use the option called “Reset on edit”. If the supervisor creates that record, it doesn’t fill anything like IFS(NOT(USEREMAIL()=“”),TIMENOW()). That will take care that it will use it as a default value if someone else than supervisor is creating the record.

When the employee updates the record it will generate the time value if you set the option “Reset on edit” as TRUE.

1 Like

Thanks Aleksi. I guess that will have to do. It means that the Supervisor will need to be much more careful when he enters his own timesheets because the defaults will be wrong.

Well… you can add that variable as well if he/she is doing an own timesheet.

Not on the path to the form, but the column logic can examine the form name using CONTEXT(). For instance, the Initial value expression for the Date column could be:

  ("Supervisor Form" <> CONTEXT("View")),

Start Time:

  ("Supervisor Form" <> CONTEXT("View")),

and so on.

See also:

1 Like

Ok, thanks. So that just means I need to somehow go to a different Input Form when a supervisor level entry is being added versus when a time sheet user entry is made.

However AppSheet seems to create its own Input_Form for adding new records with little customization available. I can make a copy of the input form and point it to a slice with only the fields I want added, but how do I make it use my Custom_Form to add a new record when I go from the Supervisor view to enter a Timesheet and use the standard input form when I go from the Timesheet view?

That is much trickier… :frowning:

Do you have a table that ties the current user’s email address to their supervisor status? That would make life so much easier!

Thanks Steve. Unfortunately that would just mean I need to create and maintain another table. Plus there are too many times when an employee needs to act as a supervisor. I will work out another alternative.

1 Like