Comparing a variable to a field in database

Hi,

Im creating a project which revolves around making a hotel reservation app. However I’m currently trying to filter out results in regards to the input of the user. In my database there is a field called country which I would like to compare with the destination the user inputs. If both of these variables are the same then it should show in the list, if not then it shouldn’t.

Any help would be appreciated, thanks.

Welcome Thunkable Beaver 30%

It’s really important to provide enough details for us to be able to help you. This includes screenshots or a link to your project so we can see what you’ve tried and determine why something might not be working.

See this: How to ask Great Questions v2.0

Hi,

sorry about that. Here is a screenshot of the database
Screenshot 2023-12-07 181033
I’m trying to compare the destination input by the user to the country field, if they are the same then the visibility should be true, otherwise false. here is a link to my project too:
https://x.thunkable.com/copy/22efe5937f57cdf29229f7f2aa6fa12a

thanks

If you have a set number of destinations, it might be better to have the user choose one from a simple list or data viewer instead of typing it in. Because if they type “singopore” or “netherlinds” your app isn’t going to recognize that as a valid destination. Using a component designed for listing information allows you to use the green value blocks associated with that component to easily search for the user’s input.

The way you’re looping through data source values is a common way people try to look up values but it’s not the most efficient:

image

Instead, use a method I describe here: Thunkable and returns a corresponding value from my sheet - #2 by tatiang

You should also be aware that stored variables will slow down Thunkable. It’s better to use app variables inside of loops (or generally any time that you aren’t actually setting the value of a stored variable). So you can assign a stored variable to an app variable and then use the app variable throughout your code.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.