Data not saving

For some reason, my data isn't saving. I have included the blocks and if you need a "aia", I can upload this as well.

Thank you for the help.

You probably do not need to save the namelist to the tinydb. Just fetch the taglist and set that to the namelist.

You got your global variables crossed.

Thank you and I make the change.

Tim,
I think I know what you mean. It's been a while since I used the App Inventor and will need to read up on how to do this.

If you have a link I can use for an example, I would appreciate it.

Thanks again,

ABG,

I made the change and still got the same results. I have uploaded a new screen shot and the aia if that helps.

Thanks for helping this old man.


DroneLog.aia (166.0 KB)

You are using RPIC as the key to your records.

What does RPIC stand for?

Can you have more than one record per RPIC?

Also, you have the then and else reversed in your test if the RPIC is already saved.
You have to reverse that.
Otherwise, it will never store a new RPIC, because they will all fail that pre-existence test.
(You start with an empty list the first time you run the app.)

RPIC means Remote Pilot in Command. It is not unique. The date is so maybe I should that instead?

I would imagine you would have more than one RPIC in play on a single date.

Could an RPIC generate more than one record per date?

You are getting into spreadsheet territory here.

ABG,

The app is designed for a single user, so the RPIC will only have 1 entry per day, per date.

Now, I could use the date as my key field because typically I only do one flight per day.

Does this sound reasonable?

Tim,

I have never used the CloudDB before, so this is new territory for me. I will give it a try and see how it works out.

Thanks again to both of you.

I suggest using the date/time as the top level tag in TinyDB, and store a record (single dimensional list) under that tag as the value of what happened on that flight.

There is an advanced TinyDB block that can return all the values in TinyDB as a list, effectively giving you a two dimensional table of all flights, in time order (if you format your tags right.)

Since TinyDB is a bit of a catch-all for all apps in the Companion, I suggest setting the namespace of TinyDB to 'flights' in your app to keep the flights separate from flotsam and jetsam from other apps.

This also helps if you want to clean out records by date later.

ABG,

I will try that one as well as Tims method.

Thank you both for the help.

Tim,

Here are my results using your method. Hope this helps you understand what I am trying to do.

Thanks gain.



.FontSize?

That's how big the text looks.

You need .Text to show what got retrieved.

Also, you should load the taglist into Elements, not ElementsFromString if you want to avoid the leading and trailing marks caused by stringifying the list of tags.

Finally, if you want the tag list to appear in chronological get the year in front of the tag, followed by month then day. The Clock component has a good FormatDateTime block that can eat a Date Picker Instant and return yyyy.MM.dd text for a more sort-friendly tag.

I made your changes and still got the same results. I have never used the Cloud before so this is cool to learn even at my age.

Thanks again!

Blocks look ok.

What is your cloudDB like in the designer:

image

and show an example value of a date you are storing.

What results?

Good results or bad results?

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

..

Those backward slashes (\) in the Date Picker .Text then into tags are trouble.

You need two filters, and a different tag format yyyyMMdd for CloudDB.

  • One to take the tag list and element by element turn it into a list of readable dates for the List Picker Elements

  • One to take the List Picker Selection and turn it back into yyyyMMdd format for the CloudDB retrieval.

You will also need a bit of code to take the Date Picker Instant and format into yyyyMMdd for the CloudDB tag on its way into CloudDB.

Also, do you really need a dozen unnamed Labels to show the retreieved data when you already have well named Textboxes?