There is a small issue.
When I tried to show the time, it appeared this (I put the instant, I don't think that's correct...) timepicker.instant on the list... what should I put instead to avoid this?
There is a small issue.
You need to get into the habit of reading through the blocks pallette of a component every time you use it, even if you know part of the answer.
Work with your eyes open.
Regarding Instants, use the FormatDateTime block on them to get something human readable.
Read that block's tool tip and follow its link to the table of formats.
SMALL issue. I think it is a BIG issue.
What you see in yellow is what happens when you post an instant in a Label. You want a formatted date.
You did not post the blocks you used to get that display. That makes helping you very difficult. I guess what you need to fix the issue might be Blocks like this
That part I already solved but there is somethings I still don't understand.
Soo I have my dosage selection on a spinner and what the user selects is put on a label and when I go on the listview screen, now everything appears correctly except the Dosage information that doesn't appear at all.
Also, could you help me with the blocks to add the in here?
Soo it can do what Taifun said because I don't know where to place them exactly:
if alarm time < current time
Then add 1 day to the alarm time
I don't have an aia of your Project. This means I can't see all your Blocks to help you figure out why the dosage information doesn't appear (in the Label ???). Post the Blocks you use to try to show medication - dosage - date please.
Did you try the blocks you posted. Looks like they might work.if you add 1 day instead of using Notification in the then puzzle piece.
You could use the AfterTimeSet event for that, calculate the correct alarm time there and store it in TinyDB...
Anorher thing to consider...
You are storing several alarm times in TinyDB...
But in the Clock Timer event currently you compare the last picked alarm time and the current time...
What is missing is to detect the next alarm time and do the comparison for that in the Clock Timer event
Also when there was an alarm, then again detect the next alarm time
Taifun
And how exactly would I do that?
Do it step by step, try something and if you got stuck, post a screenshot of your relevant blocks
Taifun
To find out if you store the correct alarm time, what about doing a test?
Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
The blocks don't look too bad...
However remember, you use the alarm time as tag... but now additionally you store it again as 4th item in the list. Can you explain why you are doing that?
Also you have chosen to ignore the date and store only the time... does this make sense?
Taifun
I've tried the "Do it" feature, but I'm still having trouble understanding the blocks. I can't tell if the blocks are correct or not.
I added it as the fourth item in the list because I wanted it to appear when selected in the list view. However, now that I think about it, this approach doesn't make much sense.
I also ignored the date initially because it didn't look good in the list view, but I plan to put it back.
Update: I tested the app by building it, but the problem still persists.
Thank you. I am not a Spanish speaker so this is difficult to find where the problem with respect to Description is located Dose seems to work sometimes.
It's fine, by the way, it's portuguese not spanish but it's very close... Anyways, can you help me with this other problem?
Additionally, there's another issue. On the screen where you add medication, if someone sets the alarm for a time that refers to the next day (like 4 AM when it's currently 4 PM), the alarm will go off immediately because 4 AM is earlier than 4 PM.
yes of course the problem still persists, because it occurs in the Clock Timer event... up to now you did not update it...
here is your to do list again
So to fix your problem all you have to do is to detect the next alarm time from the list TinyDB.GetTags and use that time in the Clock Timer event instead of the latest picked time as you are doing it currently
Taifun
And how exactly do I do the "detect the next alarm" part?
Well, you are again putting blocks randomly together... is TinyDB.GetTags an instant? And if you do not know the answer, then what about using Do it to find it out?
To be able to find the smallest item in a list it is helpful to have a list in a format, which is easy to sort...
In your case you have alarm times as items
The alarm time could be stored for example as millis (milliseconds) or in a format like yyyy-MM-dd HH:mm example: 2024-07-06 06:21 ( current time here in Costa Rica)
For the available patterns see here SimpleDateFormat (Java Platform SE 7 )
Then just use the sort list in ascending order block from the list drawer to sort the list
http://ai2.appinventor.mit.edu/reference/blocks/lists.html#sort
The first item in the list is the next alarm time you are looking for
You could write a procedure for that
http://ai2.appinventor.mit.edu/reference/blocks/procedures.html
You do that before storing an alarm time in TinyDB
Taifun
This is overwhelming for me. I'm giving it my all, but I don't feel capable of handling everything at once. I'm struggling to figure it all out.
What shoud I put on the comparison? How do I sort the list in ascending order with the blocks in the guide? And should the procedure do? I'm soo confused...
So which format did you choose?
Show us a screenshot of a TinyDB.GetTags block together with a Do it result
Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.