Hide Action button linking to a form depending on a row

Hi! I made a simple timesheet tracker where the user clocks in with an action that links to a form; the only field in the form is the current date/time and then the user hits Submit and they're clocked in. To clock out they also press an action which modifies the row and writes down the time when they clocked out. It works perfectly fine, but I don't want users to be able to log in multiple times, only once. Basically I need to be able to hide the clock in action button if the user is already logged in, and show up again if they clock out.

Could you help me with an expression for the "Only if this condition is true"
of the clock in button, please?

Solved Solved
0 6 148
1 ACCEPTED SOLUTION

Try this one

OR(
	ISBLANK(
		SELECT(
			Timesheet[Log ID],
			AND(
				[Name] = USEREMAIL(),
				DATE([Created]) = TODAY()
			)
		)
	),

	COUNT(
		SELECT(
			Timesheet[Log ID],
			AND(
				[Name] = USEREMAIL(),
				DATE([Created]) = TODAY()
			)
		)
	)
	=
	COUNT(
		SELECT(
			Timesheet[Log ID],
			AND(
				[Name] = USEREMAIL(),
				DATE([Created]) = TODAY(),
				ISNOTBLANK([Date/Time Out])
			)
		)
	)
)

View solution in original post

6 REPLIES 6

Search this forum for "prevent duplicates"

Thank you Marc, I tried but a valid_if constrain wasn't really what I needed, thank you though!

Hey. Assuming you have one table for users and one table for the timesheets, here is the formula you can play with

COUNT(
	SELECT(
		Tracker[ID],
		AND(
			[User] = [_THISROW].[User],
			DATE([Created]) = TODAY()
		)
	)
) = 0

Where:
Tracker = table for timesheets
User = ID used to connect the parent and child table
Created = Created date of the timesheet

If you cannot solve it by yourself after reading the solution above, please share the screenshot of the

  • Table Structure
  • Forms used

Screen Shot 2023-02-02 at 10.20.00.png

Tried but couldn't figure it out, thank you for helping me. Above is the table structure for the Timesheet table.

 This is the card view, with the action button to clock in

Screen Shot 2023-02-02 at 10.23.53.png

And here's the form it takes you to:

Screen Shot 2023-02-02 at 10.24.02.png

I wanted to add that preferably I'd like users to be able to log in more than once in the day as long as they have already logged off previously, but not log in multiple times (by accident or because they're bored or just wanted to see if it's posible, etc.). 

Thank you once again.

Try this one

OR(
	ISBLANK(
		SELECT(
			Timesheet[Log ID],
			AND(
				[Name] = USEREMAIL(),
				DATE([Created]) = TODAY()
			)
		)
	),

	COUNT(
		SELECT(
			Timesheet[Log ID],
			AND(
				[Name] = USEREMAIL(),
				DATE([Created]) = TODAY()
			)
		)
	)
	=
	COUNT(
		SELECT(
			Timesheet[Log ID],
			AND(
				[Name] = USEREMAIL(),
				DATE([Created]) = TODAY(),
				ISNOTBLANK([Date/Time Out])
			)
		)
	)
)

Brilliant! Worked perfectly, thank you so much.

Top Labels in this Space