Guardar y recuperar casilla de texto y casillas de verificación

Saludos, estoy iniciando con APP Inventor, y estoy haciendo una aplicación que guarde datos genéricos de un usuario y una posible lista de enfermedades. Para esta lista estoy usando casilla de verificación.
Pero no logro almacenar en la TinyBD el valor de la casilla de verificación marcada. y tampoco comprendo como hacer para recuperar los valores de los checkbox que estén asociados al usuario.

Les agradezco la ayuda que me puedan brindar.

Hello Juan

Storing the CheckBoxes the way you are attempting is not a good way to store information.

Have you made use of these resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook ... 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 and the aia files for the projects in the book are here:

How to do a lot of basic things with App Inventor are described here: .

Also look here and here for more tutorials.

Learn about components
and visit the Library Help>Library on the MENU

A similar app to what you are attempting that can save data is discussed here> Working with Lists and TinyDB It may give you some ideas about how to structure your app.
Here is another example

If you post the aia of your Project, someone might help you try to fix your Project; however I recommend you store your data differently.


Hello Juan Carlos

You are nearly there. You have a List of the CheckBox Components. However, using a Spinner (Drop-down options menu) would make a more User Friendly GUI than the CheckBoxes. A ListView would allow a large collection of diseases to be presented.

I will upload sample code a little later.

Here we are. Very ugly GUI but it demonstrates how to code the Storing and Restoring of the CheckBox States with TinyDB. Note, you can only test as an APK (Build / App (provide QR code for APK), not using the Companion, in order to see values restored from TinyDb.

SavePicksToTinyDb.aia (4.3 KB)

Gracias ChrisWard por tu respuesta, tengo otra pregunta, un ListView me permite seleccionar varios elementos? porque una persona podría elegir mas de una enfermedad de la lista.

The standard List View does not, but there are extensions that provide multi-select. Or, you can define an HTML Table with multi-select and display that in a WebView component - a tiny javascript function communicates the selections to the App.

Here is a sample project that uses a ListView to show selection status and let you change individual selections. Read the doc carefully to see how the selections are stored.

This project uses two List Pickers for the selection display and updates:

Neither project needs extensions.

ChrisWard, como debo hacer para ver las enfermedades de un usuario específico, ejemplo: John y Tom registraron su lista de enfermedades, cuando consulte a John como puedo ver su información?

You would need a secure cloud-based, central database that each User's phone could send data to.

FireBase is one such database. See my colleague TimAI2's website:

Hola ChrisWard, copié tu codificación para ver el funcionamiento, pero me muestra un mensaje de error

Agradezco tu ayuda.

Hi Juan

If you run my code as-is, you will see that it works, so you have made a change (number of checkboxes increased?) that has introduced a bug. If you study the Blocks, you can see it is designed to handle more checkboxes (or less) but they must be included in List_Checkboxes and must be in numerical order.

Hola ChrisWard.
No encuentro la diferencia que me genera el error, lamento causar tanta molestia.

Look for a mismatch between the list of tags in that TinyDB and the list of checkboxes.

For example, when you renamed the TinyDB did you also remember to rename its NameSpace to separate its storage from the original TinyDB that the Companion uses for all your projects?

To verify this, do a Do It to show the result of your .GetTags, and look for surprises.

By the way, matching tags and checkbox components by index is fragile, easy to break. Consider coding a lookup-in-pairs structure to transform tag to checkbox and vice versa.