I need to get a simple date added and then modified for each day, in the database to indicate the day a user is on. So right now I am trying to get the signup form to add the signup date and create the first instance of a day number field. So on the day of the signup, it should be day 1, the next day after, day 2, and so on.
What I’ve tried isn’t working. I have the DB with the day field under the users table/collection set to a number field (tried with text and a custom formula but that also didn’t seem to work). In the form, I have a hidden calculated field that I tried a bunch of formulas with but never got an input submitted properly to the DB. This is what I thought would work: round(current time - signup date)/1,0)+1. Both fields were set to date/time (but also experimented just with date).
Anyone know how to first create the simple calculation in the signup to DB flow, and then have it auto-update in the DB based on elapsed day?
User created date is the field “created date” in Users collection. It is a built-in field which stores the datetime value when a record was created. “Created date” and “Updated date” fields exist in all collections.
Round(current time-tomorrow) will result in either -1 or 0. Time is stored as a number of days since 1/1/1970, and the fraction is the “day percentage” (so 12:00 PM in UTC+0 timezone will be 0.5). If you’re not in UTC, then your local timezone difference is applied when displaying time. So if you’re operating in datetime space (not using pure date anywhere), when you deduct current time from tomorrow you are deducting smth like 19654,742 - 19655 (if you’re in UTC+0). When you round that you will get either -1 or 0.
Thanks for that explanation @Victor . I left the initial calculation intact but I guess I could just set it to “1” when someone registers, then add an action to update the record when viewing the home screen. Is that the best way though, or is there a more efficient/graceful way to update the day number by date? The day after signup, it should be day 2, and if I leave the calculation I had above, it won’t change (nothing auto-calculating outside of the signup process itself IMHO). The format you have above seems to work too, but it won’t auto-update once a user signs up, am I right?
Sorry, but I’m not sure I understand what would you like to achieve.
My example is how to display number of days since a particular user has signed up. If you would like record the day when user opened the app for the last time, you will need to add a separate property for that and update it to Current Time when a user opens the app. So you could place this action on a Home screen.
Please keep in mind that if you create on-screen-enter action, it will be executed every time a user visits this screen, which will affect your actions counter (and therefore may increase costs). So it might be a good idea to make this action conditional - you can try smth like “execute when last visit date is before start of today”. Testing is required - can’t provide detailed solution now.
So what I initially meant was to get the day counter started as a user signed up, then as each day elapsed, increment the day counter to match records for a daily task list in the database. So since each user can sign up on another date, the counter needs to be specific to them. I was just unsure if the recommendation you provided increased daily, but it seems that it would?
Appreciate the info regarding wasted actions, I do need to be aware of how much I’d be using when I switch to a paid subscription (and already hit 100% of the free record allotment ).
@Victor ,I tried the formula you provided and changed the database property to a text field, but upon sign up, it didn’t record a value. So the DB is empty for the Day Number property… Am I missing something?
I did these steps:
Changed the DB property to a text field called “Day Number”
Added a custom formula to an automatic field in the form with the formula you provided (INT(current time - user created date)+1
How do I actually auto-increment the day number? The form won’t add it in my opinion, because the user isn’t created yet, so the signup date or created date doesn’t exist - thus no entry. Thus empty DB records…
So ideally the homepage would update the user’s list items based on the signup date and day number. So If I signed up yesterday, I should get day 2 list items and not day 1 list items, and so on. Problem is, the action I have keeps updating the day number every time the page is refreshed, and if I remove the action, the user stays on day 1 for perpetuity.
Then filter your list so that day = logged in user current_day
When a user signs up on Day 1 (Monday), they see Day 1 content, if they visit next on Wednesday they see Day 2 content. When they visit on Thursday… Day 3 content.
It gets trickier if you want to skip content if the user has not opened the app that day. ie. Monday = 1, Tuesday = 2, Wednesday missed, Thursday = 4. I think Victor has given you the goods for that.
That’s helpful. I got it to work with a combination of conditional statements and the particular signup date. Seems to be working now, and I think it reduces the use of actions… on that note - is there a log or way yo access the number of actions actually taking place? Like a counter?
Weird but I don’t see what Adalo has in their help docs, just an advertising banner for seeing plan options, even though they say you don’t need a paid account to see it. No other buttons or options to skip or cancel the upsell banner…