Help with Habit Tracking function

I’m trying to build a button that records a daily task. The user is supposed to press a button each day that they perform the task (similar to the Streaks app).

However I can’t seem to get this to record in a way that I can use the information.

What I tried:

  1. Created a button: This opens a modal that asks if the task was performed today or yesterday. (similar to Streaks)
  2. If the user records “Today”, this should change the button from visible to invisible (and make a second button visible).
  3. I created a collection called Writing Day.
  • This collection includes Date and User (relationship is Multi-Multi)

My issues:

  1. I can’t seem to get the Initial button to turn invisible. I can’t call any information to allow me to make a rule.
  2. I’m having an issue where if the user presses “Today” and then the next day presses “Yesterday”, it will record twice. (It would be best if i could have the “yesterday” button disappear as well as make a rule that dates can only be recorded once.)

Basically, I’m having an issue with setting up the database in order to set rules against it. If you can help it would be much appreciated. I’ve spent the last few days trying to figure something out and I can’t seem to get it to work.

Are you familiar with the “change visibility” setting?

1 Like

Hi @nodnarb1129,

Yeah, I know how to use the “Sometimes visible” setting. (I made a 2 button follow/unfollow feature on this same app).

My problem is what data to use in order to get the button to disappear.

Hi @Michael,

From what I’ve understood (this tasks logic is not very clear to me), the possible solution could be adding the DateTime record to your Users collection, calling it “LastTaskPerformed”, and changing buttons’ visibility based on this timestamp.

You could find the hints how to work with adding/substracting time here: Help : StarTIME +60 = funny Endtime 🤔

1 Like

As far as I understand it, Vance’s option is the best solution available.

Hi @Victor,

Thanks for the help. That solved one of my issues.
I’m posting a picture of the screens I’m using so you can have a better idea of what I’m talking about.

So I can now get the first button (under the Daily Writing Tracker) to disappear, but what I’m now needing is for the “Yesterday” button to disappear.

How it functions:
When the first button is pressed then the modal opens and they can record the task for “Today” or “Yesterday”.

This is recording to a collection I’m calling Writing Day that takes in the Date and User info.

The problem I have right now is if someone presses “Today” and then the next day presses “Yesterday”, the event will be recorded twice. But I can’t seem to make a rule to get the “Yesterday” button to turn invisible.



If the yesterday button needs to disappear if today is pressed just create a visibility rule based on the “count” of that button being pressed. Depending on your DB structure, you may or may not need to create an extra record for this.


Yeah, I just figured this out.
I set it to disappear if the LastTaskPerformed has the 1 day before date.
Thanks @Colin

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.