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

Hi, my app has been partially approved, so ancient knowledge can meet modern technology again.
I said "partially" because most people had iPhone and couldn't test my app. I hope it will soon be possible, ...are you still working on iOS?

I now proceed with fixing the data storage following ABG's suggestion to associate TinyDB with Clock.

My data consists of:

  • user detects the informations in his pulse by Self-Pulse Reading Technique, then clicks buttons on various pages of the app, writes notes and saves his data as one reading session (a text string that will be added as an item to the list of readings).
  • about 20 or more readings can be taken in one day, …or none.

Data organization:

  • one reading will be saved as a Tag with the Tag name corresponding to the Time of that reading
  • all readings of a day will be grouped in Namespace with the name corresponding to the day of those readings.

I guess the Tag is like a file, while the Namespace is like a folder that contains many files. Am I right?
The Clock parameters must be transformed into Milliseconds in order to be saved as names in TinyDB.

Data display:

  • the readings will be displayed in the table on the "List page" of the app
  • when the "List page" is opened, the readings of the current day will be visible
  • user can choose the date in DatePicker and view the readings of the previous days.

table

I am currently using TableView extension. I cannot build DynamicTable with WebViever (I tired) because I use android 6 as a Companion (all other my devices are iOS), it also requires TaifunTools extension.
I would like to avoid any extensions in my app (seems they are for android only), so when it will be possible to export the project for iOS I will not have to change anything. Am I right?
I started building the table by simply using the Table Component and Labels, but I'll work on it later.

So far I have done:

  • I built DatePicker and it works:


    DatePicker must show dates from now towards the past. Therefore, when the “List page" is opened, the Date Picker "right arrow” is disabled and has the image "off". When I click the "left arrow", the "right arrow" becomes enabled so I can slide through the dates up to now.
    When I go back to "now", the "right arrow" should become disabled and change its image. How can I do?
    It would be also useful to set in the DatePicker dialog (popup) as the active dates only those ones on which the readings were archived, but it is secondary thing.

  • I have read several posts/tutorials/video about the use of TinyDB and Clock, I have tried to understand especially this one:
    Creating Profile to store other reading - #6 by ABG
    but I gave up, ...toooo complicated for me and i don't know which blocks are really useful to me.
    Right now I've done like this:


    ...but obviously it doesn't work.

This is my project file:
Nadi_04.aia (975.6 KB)

Can you guide me step by step, please?

So my first question is: how to correctly store one reading in a Tag and set the Namespace for that Tag?
It must be possible to recall that Namespace later with the DatePicker in the "List Page”.

Thank You :cherry_blossom:

1 Like

You are in a difficult position as an app developer.

  • You are "Mr. In Between", bouncing between
    • Your guru, the sponsor with no idea about data visualization
    • this board, with pre-cooked solutions for other problems, and
    • your lack of study of the fundamentals to collect and display data.

I am reminded of the advice in the 1944 song "Accentuate the Positive"...
https://www.google.com/search?q=accentuate+the+positive+lyrics

Note the references in the song to "Mr. In Between".

2 Likes

Thanks Abraham for your feedback.

I hope to proceed with the development of my app and am awaiting the answers to my questions in my post.
Thank you :slightly_smiling_face:

yes.

The Clock date/times must be transformed into Milliseconds in order to be saved as tags and values.

The Table Arrangement is susceptible to copy/paste errors, and has corrupted projects in the past. Keep good backups.

My specialty!

You will have to go back and reread that, because your problem is just as complex.

Study procedures at
http://www.appinventor.org/bookChapters/chapter21.pdf
from
http://www.appinventor.org/book2
from

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