Cloud DB is not saving any info

Im self taught app inventor user. i have created an app for our farm. one of the things it does is it helps keep record of bale counts ( we grow and bale alfalfa) so one part of it is record keeping. I was using tinydb and it was working perfect however i wanted the information to be shared to everyone that had the app downloaded and thats when i learned about cloud db. I am pretty sure i have the blocks built correctly however when testing the app its not storing the data i enter. i click save and then when i go to view the info entered its not there im not sure what im missing or not doing right. i dont know if its in the properties of cloud db (i left all those as is cuz i have no idea what to do) please help


here are the blocks i currently have built first picture was not correct

Can you send aia file?

Your blocks image is unreadable. Right click on the blocks editor, and save blocks as image.

2 Likes


here is a better view of my blocks. Im sure i did it the hardest way possible but like i said im self taught and still dont understand everything. I just dont understand why after i enter infomation such as date, stack yard, and bale count and i press save cloud db does not store the information so i am unable to retrieve it. any help would be greatly appreciated.
Thank you

From what I can see you are not updating your variables from cloudDB correctly (or your cloudDB from your variables) and therefore you appear to only be working with your global variables in your app....

Your workflow should be something like this:

On Initialise
Set your global variable list to the "value" returned from cloudDB

On update of your global variable
Store the new global variable content to the cloudDB tag
(if necessary) set your global variable to the value returned from cloudDB

In this way you can keep your global variable synchronised with the tag value on cloudDB

Export your .aia file and upload it here.
export_and_upload_aia

2 Likes

MGfarm (1).aia (1.6 MB)

I am looking at your app, and I see "Tonopah" and "Spot".

Is that a location (in Nevada?), or something else.

Likewise for Spot.?

Also, you need a tag redesign.
Capture

I see multiple keys in your app:

  • date
  • Farm (Tonopah / Spot ?)
  • Field
  • stack number (is this identifying which stack, or is a count of stacks?)

then I see a possibly dependent value:

  • bale_count (tells how many bales were in that stack?)

and a sold/notsold indicator (tells if the entire stack was sold, or just that count of bales from the stack were sold?)

It would be useless to proceed without knowing the shape of your data.

P.S. I made some spot corrections to your blocks, but they would not help unless the tag/value problems were addressed. You are in a multiple simultaneous update situation, so keeping just two possible tags won't work for you.

Before:


After:

Before:

After:
blocks (4)

This is total nonsense for a two tag DB.

The Value If Not There should be an empty list, not a blank. Blanks are not lists.
You have no business updating the ListView Elements here. The new global variable data has not arrived yet. So don't do that.

I include those so they won't go to waste, for educational purposes.
Still need to pin down the data structure.

I can't find previous threads on this app, so I will double check with you on a critical requirement ...

Does this app need to operate in a mixed online/offline environment?

Continuing my analysis of your blocks, I must advise you against some disastrous code, that launched a cascade of inserts that threatened to fill up the MIT default CloudDB server before it overflowed app memory:

These blocks (aside from the logging debug I added at the top)
cause AI2 inserting anew the entire list for a location each time that location's data changes.
It's like an avalanche of inserts.

Another place you do this:

If I were to guess its original purpose, I suppose it might be leftover from an attempt to cache updates while offline, and catch up the updates when back online.

Here's another problem area, involving unnecessary duplication of code.

You have two possible Farm values at present:
Farm

(The mysterious Tonopah and Spot names are revealed to be farm names.)

In your blocks, you entirely duplicated global lists, tags, and code for each of the farms.

I saw no actual difference in the data handling requirements from one farm to the other.

This could have been handled by

  • using one set of blocks,
  • adding a column naming the farm to the list, and
  • filtering the displayed list by name of farm.




This a problem, because it does not ties the SOLD indicator to the line item that was sold.
It also breaks the pattern of having a consistent number of columns in the inventory table(s).

More ideas ...

You have a heading alignment problem with your ListViews.
Capture1

There is a monospace option for Labels and ListViews that can be used (with padding) to line up columns.
monospace

Here is a left padding value procedure you can use.


lpad_test

To get a right padding effect, left pad the reverse of your text, then reverse the result.

Try This

MGfarm_1.aia (1.6 MB)

Hi sorry tried to reply to you thru my email but that didnt work.
so quick run down about this app.
We are farmers in AZ and this section of the app is an inventory tracker.
we have 2 farms one in tonopah and one at spot rd.
so we have to count the bales in the stack yard each stack is labeled so i want it
to save the date, stack # and bale count, however i want it to save under which farm its located at.
so when viewing it it will show up under tonopah or spot rd depending on the farm.
Then i was trying to get it be able to mark it sold.
I had all this working great when i was using the tiny db but when i found out about cloud db i realized thats exactly what i have been wanting so when ever a foreman, employee, or owner open the app everyone can see the inventory of hay.

omg your are awesome. so i know it all looks super complicated. we are farmers and this is a section of the app for keeping track of our inventory. We ahve two farms tonopah (in arizona) and sport rd (also in az) so thats how i would like the data to be viewed is by farm. then under each farm i am trying to get it to show in a list the date, stack number, and bale count. example
Tonopah
9/25/22 1-A-2 430 bales
10/2/22 2-B-1 560 bales

Spot
9/25/22 2-B-3 560 bales
10/30/22 2-A-3 234 bales

then if you click a line a notifier would pop up asking if the stack is sold?
click yes then it would highlight it red (or any color)
if you click no then nothing happens

thank you so much for your help i am going to go thru it all tonight after my kids are asleep so i can concentrate and take in all the help. I have been working on this app for a long time and i think it would really benefit us at the farm its just i have no clue what i am doing. i have asked friends of mine who say they know what they are doing but none of them have come thru helping me. so i thank you so much for your time and advice. I will be updating and changing some blocks tonight and will posted what i have done.

Is it possible for only part of a stack to be sold, like 210 bales out of 430?

Do they all have Internet access on their phones/devices?

(See minutes 21:00 to 24:00 of ...)

Another question regarding inventory management:

If multiple people are updating inventory records, it would be a good idea to record their names with their updates, for accountability.

Who needs hay rustlers?