How can I create data storage using clock component and display it in a table using calendar?

Ok, now it is clearer to me how the procedures work.
What is the next step?

  • Study the Clock component, and
  • use the Do It debugging facility to see the values of Instants and Milliseconds values.
  • play with the blocks that convert between Milliseconds and Instants
  • Examine the Instants that return from both Date Pickers and Time Pickers.
  • Reach the point where you can explain why Milliseconds are such huge numbers.
  • Read the Designer help links (?) for the Clock component
  • follow the help link for the formats available for the Clock FormatDateTime block
  • reread your posted blocks and find the place where you misused that block.
1 Like

I have studied these things before as far as I could understand. I'll study it better as we tackle the specific blocks. I have to see it practically applied, otherwise if I only study on an intellectual level I become more confused.
So I'd like to know where we start from to fix the blocks. It will be easier for me to understand one thing at a time.

You need to be able to see your data in the blocks, using the Do It facility.

Post a Do It of Clock1.Now() and a Do It of Clock1.SystemTime.

What do you mean?

Are these the blocks you asked for?
01

http://ai2.appinventor.mit.edu/reference/other/testing.html
from

My "Do it" is disabled on all blocks of procedures / events / variables.

do it

I'm looking forward to assembling save_reading procedure.

If your Project is not connected by using live development (the Companion or emulator) DoIt is disabled. Load your Project using Companion and DoIt will become enabled. :slight_smile:

1 Like

Thanks Steve :slight_smile:

So, here are my "Do it":
do it 2

Now is used with GetMillis to show milliseconds.
SystemTime displays milliseconds by default.

You can save time using either to provide a time stamp.

time

The different times show slightly different ms because the ms changes every time you request a DoIt because " time marches on" (ms elapse while you take the time to invoke the second DoIt).

Ok, great

Abraham asked me: "Post a Do It of Clock1.Now () and a Do It of Clock1.SystemTime."
...so I'll wait for his next step

Instead of wait, I would suggest to modify your blocks accordingly, what is expected. As you have learned what is what and how to Do It over the blocks and see what data is there at the run time, so now it is time to apply knowledge practically.

Hi Ram, nice to see you

So this is my interpretation:

Is it correct?
How do i see my data there? ...right now, obviously, "Do it" results empty.
Can the same Clock component be used for table display and for Namespace setting? ...they have two different formats.
I tried to display it in the table, but I'm getting confused.

No, how would you go back into Past Time, Clock run in forword direction only.

Looking inot your current setting it is not possible, untill you have stored your all created namespaces in a list. Since you are storing one data under one name space which is not logical.

Please read below Q/A, response is really Great!

Question and Response

Edit: and parameter missmatch is also there,

DateTime != DayTime

Here's why I proposed one Namespace per day, and one MilliSeconds value per tag per reading ...

That allows all the tags of all that days' readings to be accessible via a TinyDB GetTags block, to allow the readings to be copied in a loop from the current NameSpace into a table for whatever table display technique you want to use.

This app expects multiple readings per day, and I added the NameSpace separations to avoid the runtime expense of marshalling multiple days' readings unnecessarily.

1 Like

Sorry, ABG I didn't go thru the complet discussion loop, but I didn't see how programm will memorise the namespaces, which is continuoulsy being created. That's why I asked to maintained a list to keep the record for the same. I just stared from where I was refered. Thnaks

Ela, I dont think so, here it is very straightforward code, DB-> UserProfiles-> reading fram.
Here, in your code it seems to be one user will be owner of the db or one user control. And you are seems to be done Great, as you have sucessfully save the namespace for one day and under that namespace you have saved the one reading of pulse oximeter sensor for different fingers ( I just visually verified ).

But in the ABG's code example there was a logic to have namespaces for profil(s), but here you are just saving multiple readings for one day, and perhaps for one user only. Why don't you have a dictionary, day as Key and list of lists as value for multiple readings. Your app will be having two options in main page one for having new reaidng and one options of read old readings.

Go to a sepcific namespace and populate the underling tag using get all tags and enumarate them all to render them.

The way you had saved the data, the same way you will be using to retrive them, millis or a specific date-format.

and maximum querey/concerns have already been answered here

Here are some blocks to take an Instant and back it up one day ...
backup_one_day.aia (1.7 KB)
blocks

So yes, you can indeed run time backwards using the Clock.

Since your app does not run any alarms or metronomes, you only need one Clock component to gain access to blocks that manipulate time values.

1 Like

Thanks for all the replies :slight_smile:

I understand my "save" blocks are correct.

...this was because I corrected the image and forgot to correct "DateTime", ...it's all right.

With this setting, will the new Namespace be created automatically the next day? ...and the previous Namespace remains archived?

...interesting, but it is sufficient that I give the user only one option: all readings by clicking the List button.
The user can save his data without looking at the table every time the reading session ends. He looks at the table mainly when he wants to compare various readings.
But maybe this solution can be useful when I will need to recall namespaces with datepicker? I don't know how to do it yet.

Now I think it's time to build the table, ...without extensions.
I could assume a maximum of readings per day: 50
What is best to do:

  • use Table Arrangement with 50 rows
    (ABG: "Table Arr. is susceptible to copy/paste errors", ...can it be a problem for me?)
  • use 50 Horrizontal Arrangements with the fixed length of Labels?