Tinydb import data and split into variables

Hello, I am creating an app using tinydb. I have the app saving 3 pieces of info under each tag. Info #1 is the game name info #2 is startdate and info #3 is enddate

when I go to load it into the list I keep getting Game 1 ["03/12/2022","05/12/2022"] how can I brake this up into 3 variables so that I can use them later for example if the current date comes close to the end date send a message.

I would also like to clean up the listview to get rid of the brackets and quotation marks and possibly add "start date:" and "end date:" to the view for each one. Maybe change the text color of the Game 1 name.

I have implemented a few snippets I found from the web on saving and importing the data from tinydb but did not find anything on how to break it up.

thanks for any help

below is the main screen that populates the list view

Post a screenshot how you save data to tinyDB

Hello. Here is a screen shot of saving to my tinydb. this section is on another screen where the user enters the info. it has 2 datepicker boxes and a dropdown list picker. infolist is initialized as a global "create empty list"

here is what i am doing with the date after the user chooses it from the datepicker.

Try this way

Result

I will try to explain it a little better of basically what I want the app to pretty much do.

I want the item list (listviewer) populated with

Game1 (subscription) preferably in a different color
Start date : (start date) End Date: (end date)

Game2 (subscription) preferably in a different color
Start date : (start date) End Date: (end date)

Etc..

When the user. Clicks on one of the games they can then click on a button to delete it from the database or do other things. That part I have pretty much setup.

I want to store the end date in a variable so I can email or notify user through notifications when the date is a week away from the current date

I will give that a try looks nicer already :smiley:

Do you know if the color of the title game 1 can be changed? Or does everything have to be one color?

Didn't know if there was a command you could put in like \n or \t

Thanks

Yes another way is

Designer's properties
image
Blocks

Result

Otherwise you can create your custom list dynamically using either [Free] CompCreator - create component dynamically or [F/OS] - Dynamic Components Extension (for every component) 2.2.2 - Extensions - Kodular Community

Awesome! Thank you. Does that go on the load page with the listview or on the add page where it saves to the database?

Is the end date saved in a variable now so that I can go through the database and find the dates that are about to expire?

I like the blocks you sent me

Thanks

On the load page with listview. Also if you wish to save end dates do

Thank you. Will this save the end date as a variable so I can do a for next type loop to compare to today's date and find the ones that are about to expire and send a notification?

What should global end_date be initialized as? A empty list?

Yes as an empty list

Thank you for your help. Your awesome

1 Like

hello again. Sorry to bother you but I have been trying for hours to make the remove item routine work. how would I go about removing an item and saving the new database. It will remove from the list on the screen but will not save a new tinydb properly. Here is what I have in my delete button

global element_list stores all the values from tinydb

the tag is Game 1,Game 2,etc. (global subscription) depending on which one they clicked on in the listview

Apply Do It to see your lists and values.

When using TinyDB, take fresh copies of lists you will update, and do not delay saving updated data back into TinyDB.

1 Like