Need Help: Search in a database and return a value

Can someone help me doing the following:

  • I have a data type called “Offers” , it has 2 fields “Value” and “Discount”

  • There are 3 entries in the Offer table:

  • I created an “input form” and a result element “text element”
  • What I’m trying to do is: when a user types a number in the “input form” I need to do a lookup in the “Offer Value” entries and check if the input value equals any of the Offer’s value then return the Offer’s Discount details , if there is no match show “No available offer”

If a user types 1 in the input field the result should show 10%
If a user types 4 in the input field the result should show “No available offer”

I’m relatively new to Bubble and I went through all video and trainings and searched the forum but couldn’t find a solution for this one.


1 Like

Hi @majd!

I believe you could set up 4 conditional statements in the text element. It should go somewhere along When Input’s value is #, then under select properties to change select text and type the conditional variable tied up to that # value (in your case it would be discount). Repeat this for each value except for the last one where instead of using When Input’s value is, you should use ‘is not’.

There are other ways of achieving this, such as doing a search for the Value from the input element in the Offers data type.

Let me know if it worked!



Hi @emilioandzak
Thank you for your reply.
Hmm I’m not sure if this solution is sustainable , let’s say I have thousands of entries , in that case I need to create long list of conditional statements, right ?

Can you elaborate more about the second part , how can I do a search for the Value from the input element and return a Discount type info ?
I’m looking for something similar to Vlookup formula in excel , (take input value and search for it in the Offer’s list , if it matches with any , returns a value of a field of the same entry , if not , show “no available offer” )
I’m quite sure this should be doable on Bubble as it’s a common use case in any app in my opinion.


Hi ,

If I understand what you’re looking for you could do:
create a text element and let it display dynamic input --> Do a search.
Then, do a search for “Offers” and give the input for the value field as a constraint. Then display the Discount field.



1 Like

Thank a lot @klaas.vanhoeck Klass , that exactly what I was looking for , I’m quite new to Bubble and still trying to learn how to apply these logics in Bubble’s formulas.