Logic for Time-Off Tool

Hi there,

I am a newbie to Honeycode, i am trying to start off by creating a time-off tool for my team. The template is a great place to start.

Specifically, i would like to create logic that notifies either the user or manager that a person is trying to book time off at a time their colleagues have already booked off. I am uncertain where to begin! Also other things such as a user is trying to book too time off beyond the limit etc. Also where would i put this - in the builder itself or in the time-off table for manager to view?

Any guidance would be much appreciated.

Thanks.

logic that notifies either the user or manager that a person is trying to book time off at a time their colleagues have already booked off

You've picked a tough one to get started with, but Honeycode can do this! :slight_smile:

Here's my table:

Use the format button to apply a column formula to [startConflict] that will count the number of rows in which this requests' start date lies within the start and end dates of any other request.

Here's that same formula, formatted a little nicer...

=IF(
	rows(
		filter(
			requests,
			"requests[startDate] <= % AND requests[endDate] >= %",
			[startDate],
			[startDate]
		)
	)>1, 
	TRUE,
	FALSE
)

The filter() formula fetches only the rows that match my logic of ones that are in conflict. The rows() function counts how many rows got found by the filter. The filter will always return at least one row, so we use the IF() funciton to see if more than 1 row came back. If so, we return TRUE.

I use a slight variation on this formula for the endConflict column.

=IF(
	rows(
		filter(
			requests,
			"requests[startDate] <= % AND requests[endDate] >= %",
			[endDate],
			[endDate]
		)
	)>1, 
	TRUE,
	FALSE
)

Finally, the anyConflict column uses an OR() to check if either of the two columns holds a TRUE value.

1 Like