Linking multiple tinyDB together

Hi,
i have been trying to create a to-do-list with alarm
i have use one tinyDB for my task and two other tiny DB for timepicker and datepicker to select time and date. how can i link the both together so that my task has a time and date linked to it. as i would also like to use the timepicker and datepicker to set up alarms/alerts in the later stage of development
thanks

Why ?

Use one tinydb and save all three elements together in a tag (either in a list or a comma separated string)

Do you have an example ?

Something like this:

Alright thanks!!

hi if all my element are saved together in a tag how can i display a specific element when i call for TinyDB

Following on from my previously posted blocks:

Once you have posted a few entries to the tinydb, you can call back a list of the "tags"

I have added these to the elements of a listview, which enables the user to select on of the tags. once this is selected, I have shown how to access each of the items in the list of the tag and displayed them in a label

This is just one way of doing this, there are many other methods....

1 Like

hi
is it possible to check all the tags value to see if they match the instant date and time to call for an notification, as i want a notification to appear when the of the reminder is due, and how can i identify the tag so that i can display the tag in my notification
image

Sort of negates the point of tinydb.....

If you store your entire database as a list, then save this to tinydb for safekeeping after a change, calling the list into the app on start up, you can work with the list.

See here:

can you explain further, sorry

Something like this:

The clock is set to run every second to check the list for matching date/times. This might be too much. Remember the date and time variables you are saving are strings and not date numbers (instants).

You should stop the clock if it finds a match otherwise it will keep generating notifiers for a minute. Then restart the clock when closing the notifier (after a minute, using another clock timer)

Can you see how I work with the list, and save the whole thing out to the tinydb, as opposed to saving individual tags?

listsinsteadoftinydb.aia (5.3 KB)

1 Like

This problem requires three TinyDB instances, each with their own Namespace:
tdbFuture tdbPast tdbPresent

The tags in all 3 are text representations of a date/time value:


This format was chosen so that the oldest in any TinyDB will sort first in its tag list.

With 3 TinyDBs, we can easily fill List Picker Elements lists with tag/value pairs ...
Capture

We add new future events to the Future TinyDB;
Future

when Screen1 Initialize

Monitoring for events newly due is done by Clock1.Timer, repeating every second.
We don't check for exact time matches, because events may have come due while the app is not running. Instead we just check the oldest future event:


We Notify the user of each event, one at a time, and we move them from Future to Present TinyDB, same tag/value.

Different List Pickers have different Selection options:

Present Events:
Is event done

Past Events:

(I left out editting/deletion for Future events. The pattern should be clear.)


PastPresentFuture.aia (7.8 KB)

P.S. Credit for TinyDB NameSpace names: Charles Dickens

1 Like