Help needed to form a "word of the day" app

Hi, I am trying to make a very simple functionality as indicated in the topic. I have a list of 5 words that I wish to be able to use to display a new word each day. So if a user logs in for 5 consecutive days, he would have seen all the five words, one on each of those 5 days. If however a user logs in on day one and then logs in after 5 days, he will only see the 2nd word since he is logging in for the 2nd time.

Thanks for any help in advance.

The first question I would have is how do you define a log in?

Glide by default will keep a user signed in (indefinitely, as far as I’m aware), so just because a user opens the app on 5 consecutive days, that won’t necessarily be 5 logins (or even any at all).

But lets assume you want to show a different word each time they open the app on a new day, I’d probably use a combination of some date-based logic and a counter. The counter to keep track of which word they should see, and a date/time stamp to keep track of the last time they saw a word.

2 Likes

Hi Darren,

You are correct. What I meant was that the word should cycle every new day whether there is a login or not.

I was looking for some help on the logic and what it should be.
Thanks

1 Like

Okay, so expanding on what I said earlier…

  • You could add two columns to your User Profile sheet
    • A date/time column: each time you present a “word of the day” to a user, you set this column to the current date/time
    • A number column: each time you present a “word of the day” to a user, increment it by 1. As you only have 5 words, once the counter reaches 5, reset it to 1.
  • You will also need an if-then-else column to compare the first column (date/time) to the current time. If it’s been greater than 24 hours, then show the next word.
  • If you present the word in any sort of action component (Button, Action Text, etc), then the act of the user tapping on the component could trigger the logic to set the timestamp and increment the counter (via a multi-step action)
2 Likes

Hi Danny,

I have been trying to wrack my brains over this but seems like i am unable to figure it out.

It seems to me that the word cannot be displayed automatically without a trigger. Like the user opens the app and the word is there or changed depending upon whether it’s the first day or any other.
I also cannot figure how to manipulate the count increment. Does it need to have an initial value too ? ( like zero maybe )
How to get the current date into it’s column without a trigger like action text or button ?
It has me going in circles. Please help. Thanks.

Darren had the right idea. Are you building everything in Glide sheets or are you also using google sheets? If you are using this in google sheets myself or darren could whip up a quick script that could help you. Otherwise in the Glide sheets is pretty straight forward with Darren’s approach.

Hi ! Thanks for the reply. I am using google sheets. Here is a link to my sheets.

I would rather that you help me learn this than get a quick solution. It’s an idea I would like to implement elsewhere as well. So if you could help me learn this I would be grateful.

Thank you

1 Like

That’s the attitude I like to see! :clap:

You can use the current time as the trigger. Compare the current time to the last time the user saw a word. If the difference is greater than 1 day (or the timestamp is empty), show a word.

Use an Increment action to adjust the counter. It will have an initial value of “empty”. The way I normally deal with this is to have an extra if-then-else column: “If counter is empty, then zero, else counter”

As I alluded to above, you can deal with an initial empty state as part of your visibility conditions on the component that displays the word. Then prompt the user to tap on the word to acknowledge/dismiss it. This will trigger the action sequence to increment the counter and set the date

2 Likes

If you are using google sheets there are quite a few ways fo doing this. What I would do is setup a simple daily trigger to randomly change all the words in that column at midnight. it would be the quickest and easiest solution I believe.

Hi Dreary and Darren,

Thanks loads for the replies. I am sorry for a delayed response. I am having a little trouble getting a foothold on setting the date bit. I tried using a button but my dates maths is going all wrong.

@ Dreary, your solution is what i was trying to achieve but since I could not I tried to use the button as a trigger. I used the =today() in the data sheet but it doesn’t work since all values change of all rows once the date changes.

If I could correctly assign the current date and store that in a column (timestamp or date column) without it changing thereafter, I think i’ll be able to solve it using a button at least.

@ Dreary, could you please tell me how to setup a daily trigger that can then be used instead of a button. If you could please explain how to add the date into the sheets on a trigger I think i’ll be able to manage from there.

Thanks loads !

I think you need a compound action: first set a column (let’s name it “word date”) with today() and then show the word, or vice versa.
Next time user logs in you compare current time column with word date

I jumped into the sheet. Are you only using these 5 words? I requested access. I think I can get you setup, pretty quickly.

Ok, so here’s what you can do. This is a simple script that you just setup to run once a day at midnight. so it takes out everything else.

 function random() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getActiveRange();
for (var x = 1; x <= range.getWidth(); x++) {
 for (var y = 1; y <= range.getHeight(); y++) {
var number = Math.floor(Math.random() * 4) + 1;
range.getCell(y, x).setValue(number);
   }
 }
};

Hi , I sent the link to the sheets. What access do you need ? Let me know. Thanks.

Hi,

Here is what I have managed to do so far. Using a button I set the current date in the Users sheet provided a day has passed since the last click. I also increment a count. So on each new day when the user clicks on a button called “Go”, the date will be recorded and count incremented. Using the count, I used a look up relation in the Users sheet.to get the word for the day from the words sheet. The words sheet has a 2 columns named sno and words. So using sno as lookup I get the word in the relation column todays_word. When I simulate, it’s good.
What I now want is the “Go” button to disappear if the date is unchanged ( which I can do ) and another button to replace it with the todays_word displayed centered in it. This I am not able to achieve since the relation (lookup) column is not showing as an option in the data of Users sheet. So what trick can be used to display the relationship column values in a button or some other component, if it is possible even as a workaround solution if not directly.
I hope I was able to clearly define my problem and request a solution.
Thank you !
Please find attached the pic of my data sheets.

May be an inline list with cards display

I don’t see a lookup column in your screenshots. Only the relation column. If you need a lookup column, then you should add one that points to the relation. Also, make sure the relation is a single relation as opposed to a multiple relation.

Hi, Thanks I’ll try it out and revert.

@Jeff_Hager

today’s word is the look up column that pulls the word for the day and uses count (day count that is )<> sno to pull that word into the Users table. The relation is single.

Is this what you are saying or am I misunderstanding your question?.
What I need is a method to display the word of the day , apple, in the column today’s word either as a text field or as a label on a button. Basically to display it in a nice way.
Thanks !

I’m saying that your screenshots only show a Relation column. I don’t see a Lookup column anywhere on your screenshots.

Relations pull back entire rows of data. Lookups pull back a single column from that relation.