Fetching data from Database dependant on dropdown

Hi there, I am very new to this platform but dedicated to learning.

I need to create a form to submit quote items to a table. The central part that I struggle with is displaying the price which depends on 3 variables:

  1. Category dropdown with static values (Gear operated, chain operated, or Pushup doors) that each corresponds with a particular database. Each database has the same fields where only the price field value differs.
  2. Width dropdown with number static values (1000, 1250, 1500 etc). The width corresponds with a column in each database and the values correspond with a row.
  3. Height dropdown with number static values (1000, 1250, 1500 etc). The height corresponds with a column in each database and the values correspond with a row.

I need help setting up conditions to check which database is chosen from the category dropdown to then display the price associated with the correct width and height.

An example of the database structure:

The group with number content (Another topic suggested this)

Conditions of the group to try and match the width and height to a single value in the particular database.

1 Like

Hey @dbenade :wave:

It’s hard to know without seeing more into your app but it looks like you might be close. Can you try doing ‘:first item’s price’ at the end if you are only looking for one value? Would that help?

Keep going! You’re almost there! :raised_hands:

From looking at it too, you might want to combine databases into one to make it easier on yourself. Then create a field for the ‘category’ which could be an option set. That way you don’t have a bunch of different conditions. You just add that as part of the search constraints. It will get difficult fast, the way you are doing it. :blush:

Category will have one of these options in your database: Gear operated, chain operated, or Pushup doors (Those could be option sets)

If you need some help setting things up from the beginning, let me know. A coaching session might benefit you to get the structure down right. You can schedule a session with me and I can walk you through it. One-on-One Coaching

It’s like the constraints are not filtering the data to one so it returns a list. So when I add ‘:first item’s price’ it displays the incorrect price value.

I will look into option sets. Thanks.

1 Like

What are the other values in that database? Do you need to filter on another field?

There are no others. Width Height and Price is the only ones with values other than the generic when creating a new type. Like in my screenshot above.

1 Like

Hmm :thinking: Are there multiples with the same width and height or are they all unique?

I would suggest using the inspect tool to see why it is pulling in multiple values instead of the one you are intending. You might need to make sure BOTH the height and width are not empty so it doesn’t just find one and then gives you prices for those. Maybe that is the issue?

There are multiple entries of the same value of both Width and Height but only one result where they would match. ie only one row where width = 1000 and height = 3250

I recreated the entire form and for some reason, it worked this time around.
I added the ‘:first item’s price’ and is working as expected.

Awesome :clap: Glad that worked. :blush:

This topic was automatically closed after 70 days. New replies are no longer allowed.