Help with TinyDB

Hey, everyone! Hope you are doing well! I have a school project and I am making an exercise app. When the use to enters the number of minutes they exercised that data will store in TinyDB. I want the amount of minutes exercised to add to the amount of minutes that the user might have exercised Yesterday or before today, but I am having trouble figuring that out. Could you please help me? I have included some images and the project below. Thank you! Screen Shot 2021-02-09 at 7.51.08 PM 1

MIT_AppInventorHelp.aia (2.0 KB)

Hi Richael

Before saving today's minutes, use the GetValue Block to save the currently stored minutes to a variable, then use the Store Value Block.

Will you need to go back and review your exercise numbers by day?

Yup of course, this is correct for saving the values. But tell us how you will calculate the the time he exercised??

Hello Spicy_Topics

I have no idea about the goals of this project, I have just given a direct answer to a direct question.

Thank you so much for trying to help! I will try it out tonight and let you know if it works. Thanks again!

Hi, thanks for trying to help and yes, the user will need to go back and review their numbers by day.

If you want daily numbers, you will need to store them in TinyDB.

If you use the TinyDB tag format yyyyMMdd (like 20210210) to store each day's number,
you can use the TinyDB GetTagList block to get a list of tags, and walk the list (for each) to check if the tag is in your desired range (like between 20210101 and 20210131) and add each value (if a number) to a subtotal.

Just wondering, how will the variable of TodaysMinutes change according to the minutes exercised per day?

How are you collecting them? If the User inputs the minutes into a TextBox for example, then you can simply use the TextBox text Block. :koala:

....However, as per ABG's enquiry, if you want the User to be able to see historical data, like yesterday, last week, last month, you need to set up simple Procedures to perform those calculations and store the values separately for retrieval.

I want to retrieve this data from the TextBox. I will use the data stored in TinyDB to create a graph. Please let me know if this helps.

So this should work. In the Designer Properties Palette, set the Text Box to Numbers Only.

What is the graph intended to show? If you just continue to add up the minutes, the graph result will just be one straight line?

The screen that you are helping me out with right now is the minutes that they have exercised on an exercise that was not shown on the first screen of my app. This data will be stored as "other" and the data on the first screen will be stored as "exercise name" in the graph, here is the chart example: ChartMakerExample (1).aia (11.2 KB)

I see, so the User participates in a number of Activities and your App records the minutes for each one. So your TinyDb Tags should simply have the names of the Activities, storing the minutes of each Activity separately. You can enter any Activity's minutes on the same Screen with the Activity selected via a Spinner - So a Spinner, a Text Box and a save button for the storage, a second button to see the Chart on a seperate Screen.

Is that just going to accumulate over time? A year?

Actually, I have only been working on it for at least 2 months now. Thanks for your help, will let you know if it works! Thanks again!

6 posts were split to a new topic: The operation + cannot accept the arguments "", ""