Help with an application where every day a text appears

select item from list[index:modulus(current day/5)]

I don't understand

I thought of a way to do it for some one who does not know arithmetic (except for being able to add 1 to a number in the range of 1 to 5).

So no need to take off our shoes and socks for this either.

You need two TinyDB tags

  • LASTDATE (initially '')
  • LASTINDEX (initially 1)

In Screen1.Initialize

  • set global Today to Clock1.FormatDate(Clock1.Now())
  • set global SayingIndex to (get TinyDB1 value of tag LASTINDEX, default 1)
  • if global Today = (get TinyDB1 value of tag LASTDATE , default '') then
    • set LabelSaying.Text to (select item SayingIndex from list global Sayings)
  • else
    • set global SayingIndex to global SayingIndex + 1
    • if global SayingIndex > length of list global Sayings then
      • set global SayingIndex to 1
    • set LabelSaying.Text to (select item SayingIndex from list global Sayings)
    • store global SayingIndex to TinyDB tag LASTINDEX
    • store global Today to TinyDB tag LASTDATE
1 Like

Hello and it doesn't work
updateDay2.aia (33.0 KB)

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

You can't initialize a variable like that. Try to get the value from TinyDB in Initialize block.

And I guess you have not understood what to do with the clock. Read again the instructions above.

1 Like