Inserting and reading from TinyDB

I am starting a new app. I need to insert several rows with 3 fields, Name, Localization and Picture(the name of an image, a .png file).
Then i need to search using the field Name, display the Localization and the image, the .png file.
Someone has done something like that?
Any idea or any reference will be really helpful.
Thank you.

Sincerely,
Rafael

I would make two TinyDBs, with separate NameSpaces:

  • tdbLocalization
    • NameSpace = 'Localization'
    • tag = name
    • value = localization of that name
  • tdbPicture
    • NameSpace = 'Picture'
    • tag = name
    • value = Picture for that name (it is name of file)

I would use the local Sqlite database, which offers simple methods to filter and query data

This could be your Select statement to search for a field name:

Select * from myTable 
where fieldName = Textbox1.Text

There are extensions available to access the database, for example this one App Inventor Extensions: SQlite | Pura Vida Apps

Taifun

Thank you Taifun.
I will use this extension and try my app. It is wonderful to me because I have the .sqlite database and don't need to fill it again. But I have 2 questions:
1.- What should i do to import sqlite to my app.
2.- How to display the image, the Picture field.

I am still learning this material and have many doubts.

Sincerely,
Rafael

Store the database in the assets of the app and import it on first run of the app using the Import method, see also the example project

You are storing the path to the image in the database? Just use an image component to display it

Taifun

Hello Taifun:
Yes, i am storing the path to the image, then just should i use an image component to display it?
Which one?

There is only one image component... this one
http://ai2.appinventor.mit.edu/reference/components/userinterface.html#Image

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


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