Logic to decide when to add new row or edit existing

I want to make a button that automatically makes an entry (or row in my table) that is tied to today’s date.
But I also want this button to check if there was already an entry for today and if there was, instead of submitting a new form or new row to my table, it should be editing the existing entry.
How do I add this logic to check and alter if I am submitting a new row or editing?


1 Like

1.) in the entries sheet, create an if then else column that

  • first checks if email is NOT signed in user resulting in a blank field
  • then checks if entry date is within today resulting in either the userEmail or UserID of the entry
  • else return blank

2.) in the other table (the one that will be the source of the screen with the button), create a relation that matches the user’s email/ID to the if then else in the entries sheet. There should be one match if you only allow one entry/day

3.) the button action will be a multistep action with a condition. If relation is empty (no entry today) then show form else link to screen > relation to entry from step 2



Wow! Thanks for the detailed reply. I’m still trying to digest it haha. I just started so I have a lot of reading to catch up on.

Don’t hesitate asking us if you need help, welcome to the community!


UPDATE: I got much close to what I’m looking for. I just need to be able to reference today’s date when doing a relation. I put today() in a cell, but I guess i need to wait until tomorrow to see if that will auto update or not. If not, I’ll need to figure out another way to enter today’s date in a relation lookup.

Hey, I’m still struggling with this.

I haven’t even considered a column for the user making the entry in my tables. I haven’t even set up any user account type functionality, so I don’t know how to do the first check. Also, not sure what an if/else column looks like. Seems like what was first suggested is a check if they are signed in, so that column is updated when the user signs in/out which I don’t know how to setup that kind of entry to the table.

I can easily make buttons add new entries, but I’m struggling to make it check if there was an entry for today and if yes, change the button from showing a form to updating an existing entry.

If it helps, this is what the app page looks like, which should always just go to a “edit” screen where it’s either blank for the day, or it shows what was previously entered for the day.

any help is appreciated. This even got me thinking that I need to learn about database structuring as I’m not sure how to make my table.

option A

option B (separate the tables and use joins instead)

You can use a math column, type “N”, replace it by the now value and set the format to date only.

Do the same thing for the entry date, then you can do an if then else column, I believe.

If the date doesn’t match due to the underlying hours and minutes, make a template column pointing to the date columns to “lock” it.

1 Like

The structure should be:

User profiles:

Email | Name | (whatever columns you need here


Email | Timestamp (set to date only) | Today (using the math formula) | If Then Else column

If Timestamp is Today then Email, else empty.

Then do the relation of email from User Profiles to ITE column in Entries.

1 Like

Hey, sorry for all the questions, but I’m still not able to get there.

  1. If there was no entry for the current day, allow the user to add a new one. I am unable to do this part.
    a. How do I implement the above logic check and then trigger a form that will allow the text input and auto-enter the current date and the signed-in user to a new row? Is this logic done in the page setup rather than in the table?
  2. If there was an entry for the current day, allow the user to see a preview and edit the entry.
    a. I don’t have the logic in place for the above but I have achieved this by creating a page, who’s source is the user profiles table and I made the style = Details and on the screen, I added the relation column.

These are my tables. I also have 3 additional “entries” tables for different types of entries that can be entered on any given day, but I’m just trying to get one working first.

User Profiles
Email | Name | Grateful Relation

Grateful Entries
Email | Date | Today | What are you Grateful for? | If Else

1 Like

The logic check should be done before the user enters the form. You should not allow the user to see the form button once they have submitted for the current day.

The current day inside the form should be entered using the current date/time special value, it should not be a text input.