Download a file to ASD and replacing a file already there

I didn't realize it would be necessary to detail the whole app process but here we go.

My app is a horse pregnancy calculator, for horse breeders.
Horses are tricky animals to breed. The normal duration of pregnancy goes from 320 to 365 days and you almost never induce the birth as most of the time it will result in a dead foal. 90% of birth occurs at night and foals and mares are expensive so if something go wrong you'd better be there. Plus C-section are almost never done either, for various veterinarian reasons.
Mares tend to reproduce the duration of their pregnancies from one to the other, which means the breeder tend to keep data on the former pregnancies and the small signs mares do show as the birth nears.

The user registers in the app:

  • the date of breedings, which will allow the app to calculate date+320 and date+365 days and keep a countdown by pregnant mare,
  • a few data about each mare, whether it's a horse or a pony, her age, which can be relevant wrt probable gestation length,
  • the various signs they see on the mare who are preparing for the birth, and finally the date of the foaling in itself.

When a foaling occurs it will be registered in the mare's data and removed from the ongoing pregnancies. It will also allow the app to determine the real pregnancy duration for this mare, for a better prevision for next pregnancies.
The data of the mare needs to be accessible even if the mare is not pregnant.

For now I have, for data,

  • a list of breedings, as a list of list with the date, the mare's name, the sire's name,
  • a list of mares, as a list of lists with the mare's name, various infos like her age,
  • historical data for each mare, as a list of lists of events (breeding, foaling, preparation signs).

the exporting of data is about keeping this data in need of crash, sharing it with someone else working on the farm, someone to whom you are selling a mare, or some such. Some of my breeders have written data about their mares and the way they prepare and foal, going back up to 10 or 12 year. So it's not acceptable to lose this data in case of crash.

Is that clearer ?

my suggestion is to use an online database, for example MySQL to store all the data.
you only need a web host together with a MySQL database
here is a mysql solution App Inventor Tutorials and Examples: MySQL | Pura Vida Apps
there are also other online database solutions like CloudDB, Firebase, etc. you might want to do a search in the community...

each user will have access only to their own data
and as it is stored online, the user will not have any issues with data backups


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

But wouldn't that mean that the app needs to ne connected and online to work ? Even in very developed countries, wifi or broadband may not be very repliable in barns and pastures :-/

if you need an offline solution, then you can use the built in sqlite database to store the data of the user... storing data in tables is much easier than working with lists and list of lists

my sqlite extension you can find here App Inventor Extensions: SQlite | Pura Vida Apps, there are also other sqlite extensions available
my extension also offers an import and export feature

for offline solutions you then will need a backup strategy
this can be synchronising your local sqlite database with an online MySQL database later if there is internet access again, there is no automatic synchronising feature available between the databases, you will have to set this up manually
alternatively just export the sqlite database and let each user store it in a safe place