Growing from multiple if/else chains to a database

I am building an app to help with a museum exhibit. Visitors will enter a text number and will interact with some audio and video. I have it working the hard, cumbersome way (shown below) but there are over 100 different items they can interact with. Is there a way to use a database to make this more streamlined? If so, could you point me towards to right tutorial? Thanks so much!


1 Like

The easiest way is to use codes as file names, for example, change the name “time travel 3.png” to “001.png” or “001”.

A more complicated way is to create a list of matches, for example,

001#time travel 3.png
002#time travel 1.png

After entering the number 001, you need to find in the list an entry whose code corresponds to this code.

1 Like

Thanks so much for the response! Is there some sample code I can view to see how to configure a list?

1 Like

Hi there,

I’ve made a sample app that uses three images and three sounds to implement the kind of effect you’re talking about.
While you’ll have to rename your original files, you will see that the blocks themselves are very simple. The only thing you’ll need to change are the items of List.
Just make sure that the correct images and sound files are named accordingly! You may want to name them more descriptively than I have. I used the suffix ‘P’ for pictures and ‘S’ for sounds.
I used a List Viewer so that users could only pick from a pre-determined list of text items. For a longer list of items, you could pair this with a Search bar.

Let me know if that works for you, or if you have any questions. :slight_smile:


you can store it in firebase with keys 001, 002, 003… simply load data from the key user enters

if you want to use it without internet connection, you can use lists to store data… simply convert entered number to integer (001 becomes 1) and load list item 1… and list item can be another list with all the data you need for specific entry


Thanks so much - I think this will work!

1 Like

Jane showed the code, which, unfortunately, will only work on Android. The OnSourceLoaded block still does not work on iOS.

When working on your project, many subtleties will appear and it will not be possible to make it quite beautiful, but if you wish, you can see my example

By the way, during the work on this project I had a problem with one of the variables of the type “App”. The project crashed on launch on iOS 12.2. If it works, then I will try to reproduce the log errors, but this suggests that problems with new App type variables are not completely resolved.

1 Like