Efficient data handling (and a question on design)

Apologies in advance for the lengthy post - providing as much detail as I can in order to try and help you to help me, without too much back and forth :slight_smile:

Ok, so I’ve been looking over the Thunkable doco, doing a bit of Googlefu, etc, but am having trouble deciding on what would be the most efficient way of doing this, so suggestions (bonus points given for examples or links) would be much appreciated :slight_smile:

Quick summary of my app - it’s a simple drinks database I’m writing for myself to keep track of the various drinks I make, so I can keep tabs on the ones we like (I make my own spirits, so plenty of range to “play” with). Purely in order to educate myself on the platform - with the bonus of something actually useful for myself as a by-product.

Am using Google sheets as my data store.

I have it currently set up where I can filter my data set (using Sheets) based on filter text entered by the user eg. “Vodka” and it lists all the drinks that have Vodka as an ingredient. My plan from there is to call the next screen, which will list out the ingredients and their measurements for making the drink - and as a result each of the drinks records has a bunch of fields for each incredient, the measurement and measurement type (mls, “shot”, dash, etc), as well as a field for an image, description, etc.

So, with that all said - with the below, basically, I’ve got that set up for displaying the various ingredients - currently using a grid of labels. I tried the various list options, but they didn’t seem configurable enough to be able to display a triple row column of data (measurement, measurement type and ingredient) the way I am showing it here.

To give you an idea on the structure of the records in the DB:

So… I tried “When ‘screen’ Opens” doing a label.text = Ingredient 1, etc. for each of the fields - but each one of those calls was going back to the DB to get the data. Very inefficient, and as a result, slow - you could see it populating each one of the fields at a time. This is what that version looked like:

Presumably, there’s a more efficient way to do this - is it by better screen design? Is there a more efficient way of laying this out? Or is it by storing the DB record locally into variables (or a string, or an Object?) and then dumping those into the fields on load? Or a combination of all of these? Oh - I had originally considered just building a “rich text dot-list” to populate a single text field from the drinks record using a loop to build up the dot-points from the ingredients/measurements… but couldn’t really see/work out a way to do that, which is why I’ve moved on to the individual fields.

I was wondering about the “get row object from” block, but I couldn’t find a massive amount of info around that one, nor examples on how it’s used (most stuff referred to working with JSON, which I’m not).

Any/all (constructive) suggestions/criticisms greatfully received :slight_smile:

The answer to both how to efficiently organize the data and speed up your app are to use Firebase and cloud variables instead of Google Sheets. With one set of blocks, you can download your entire database locally and then manipulate it as needed. It’s much faster. But if you’ve never used Firebase and aren’t familiar with JSON, it’s a steep learning curve.

If you need to use Google Sheets, I would consider using the API to access your data. I don’t have much experience with that but I imagine it’s faster and more flexible.

Alrighty, thanks - time for some more reading/YouTubing :wink:

(Have had a quick look at Firebase… it’s certainly not a quick and easy setup. Never worked with a NoSQL DB before - it’s an interesting concept, being able to create records with different types/fields within the same “table”… and having just set up a single record, I am glad the majority will be being done via the app at some stage, because doing it manually is a bit of a pain - accidentally clicked off the bottom edge of the “create document” popup window, and it just disappeared and I had to start again. 3 times… lol)

Seeing as you seem fairly familiar with FireBase - a quick follow-up question. Do you know if the issue with connections for DBs based in EU instead of the US also flow over to a DB hosted in AU? I’ve tried every combination I can think of, and that I can find reference to in the doco, etc… but every time I try to load up my cloud variables section:
image

The doco says to change the URL away from the domain my API screen in Firebase says to use (firebaseapp.com to firebaseio.com) - but I’ve tried both of them without joy. I’ve also tried with/without the https etc. And the permissions on my DB are set to open for the next 30 days, as per the default for “open”.

Just wondering if I need to re-create my DB over in the US (which will add considerable latency to my app, presumably, being hosted on the other side of the planet, instead of in my own country)…

Edit: can confirm the location of the DB isn’t the (only, at least) issue - I just created a whole new project and DB based in the default US location, and still can’t connect.

My permissions in the DB as mentioned earlier are still on the default open:

Any thoughts on what might be going wrong here?

I don’t, sorry.

I’ve always used https:// projectId .firebaseio.com as mentioned in Connect a Firebase Realtime Database | Thunkable Docs but I’m in the U.S.

Hello @grinkingr3yr6z
To connect your Firebase, you need to set the Firebase API Key and Database URL on the project settings

image

image