Forum Academy Marketplace Showcase Pricing Features

Looking for variable column of database

Hello Everyone,

i’m absolutly new to .bubble and don’t know how to select data with a non-specific column.
For better illustration, the example below should help to break down the issues.

We have two databasis:
DB_One: is for holding the key informations of elements with different properties.
The header looks like [name_ele, prop_1, prop_2, prop_3, prop_4, prop_5]
DB_Two: is holding possible combinations of properties which have to be checked in a
different way. The header looks like [name_combi, first_prop, second_prop]

Example entrys:
DB_One: [Element_2, 12, 10, 15, 20, 18]
DB_Two: [CheckOption_2, prop_3, prop_5]
→ wanted output of the query: 15, 18

I want to select (via two Input fields) the row of DB_One (which is absolutly fine) and the columns of DB_One, which are part of the chosen CheckOption. Therefore, i’m looking for a way to select the value of the field whith a variable coloumnname (where i’m lost).
I tried different workflows for looking at the values one by one and saving them in states, which is intuitiv. The main-problem is to look for a column, which has to be chosen in an indirect way via user input.

What did i overlooked or where is the problem of the databasestructure?

Thanks and best regards,

How does CheckOption_2 connect with Element_2?

You would just need to put a conditional on the display element to “hard code” what values will show. For instance:

When Parent Group’s DB_Two’s first_prop is prop_1
Text: DB_One’s prop_1

When Parent Group’s DB_Two’s first_prop is prop_2
Text: DB_One’s prop_2

When Parent Group’s DB_Two’s first_prop is prop_3
Text: DB_One’s prop_3

Thanks for your answer!

Your Example worked perfectly. Sadly this example won’t make it productive, because the DB_One (think about a list of different materials which has a specific density, volume, surface structure …) has about 200 properties and the DB_Two (stands for different testing scenarios like “can it float” or “will it break under pressure”, which is an overview of a list of relevant properties) has about 2.000 rows.

Both Databases are not connected at the moment - therefor, it seems necessary to change the database structure. I thought it was not import, because i “simply” wanted to return all entries from DB_One with row = “material name” and column = [parameter], where the parameter is just a property from DB_Two which is saved in state.