TinyDB Guide – Store and Get data locally in Kodular app

I am here with a new guide in which I will teach you how to use TinyDB in your kodular app. We will be going into detail in this guide, knowing how to store and get data from TinyDB into your app.

What is TinyDB?

TinyDB is a component that allows you to store and retrieve data within your mobile app. It provides a simple way to save and retrieve key-value pairs locally on the device.

With TinyDB in Kodular, you can store various types of data such as text, numbers, lists, or even complex objects. It operates similarly to a dictionary or a map, where you assign a value to a specific key, and you can later retrieve that value using the same key.

You can use TinyDB to store user preferences, settings, temporary data, or any other data that needs to be persisted within your app. It is often used for simple data storage needs and is easy to integrate into your Kodular projects.

To use TinyDB in Kodular, you can drag and drop the TinyDB component from the components palette onto your app’s screen, and then use its blocks to set, get, and delete data based on keys.

Difference Between Airtable and TinyDB

Here is a comparison chart highlighting the key differences between Airtable and TinyDB:

Database TypeCloud-based databaseLocal embedded database
Data StorageTabular dataJSON document-based
CollaborationSupports real-time collaborationNo built-in collaboration features
Data AccessRequires internet connectivityWorks offline on the device
ScalabilityScales well for large datasetsSuitable for small-scale projects
IntegrationOffers APIs and third-party integrationsPrimarily designed for use in Kodular apps
Query CapabilitiesAdvanced filtering, sorting, and queryingBasic CRUD operations
User InterfaceRich and customizable interfacePrimarily used programmatically
Hosting and MaintenanceHandled by AirtableNo hosting or maintenance required
Learning CurveModerate to steepRelatively simple and beginner-friendly

Setting Up App

We will be first setting up our app on kodular. You can also add this to your existing project. I have created a simple UI you can see below:

Storing Data

In order to store data in our app locally we will be using Store Value block where we will be adding our Tag and the Value we want to store

Getting Value

So, in order to get a value from our TinyDB database, we have to enter a tag for which we want to get the value from. Like shown below:

How does this work?

So going deep into TinyDB we will be learning, how does this work? So, in order to make you explain, how this work. I will be giving you an example. For an instance, i have stored the following Tag (Email) and values (Password) in TinyDB. So if i want to get the value (password) for the email [email protected] we will be using Get Value block shown above where we will add [email protected] in tag parameter which in turn returns us the value (password), the same goes on from other email.

Tag (Email)Value (Password)
[email protected]ABC
[email protected]123
But what if no tag we have entered is present like i want to get the value (password) for the tag [email protected] , as it is not present in the stored values. So in order to handel this situation we will be adding something to value If Tag Not There which will return the thing we have put “No such email is present” if no such tag is present.

Delete a Tag

So in order to delete a tag, we will use Clear Tag block as shown, which will remove tag as well as its corresponding value.

Delete all Tags

In order to delete all the tags we will be using Clear All block which will delete all the tags stored.

Thanks for sticking to the end. See you in the next guide 🙂

Scroll to Top