Creating Input for Searchbox and Drop Down Menu

Hi guys, I am trying to do the most basic thing but nowhere in the Manual/Reference/Tutorial Videos I have been able to find the solution.

I want to do the following:

1 - User selects a car brand from a searchbox
2 - User selects a model from a dropdown menu, based on the car brand selected at ‘step 1’
3 - User selects a year in which car was built

I can´t figure out how best to structure this. I was hoping there is way to create a Data type with the values Car Brand and Car Model, in the following way:

Volkswagen - Polo, Passat, Golf, etc.

Instead I´m only able right now to seperately create all these combinations, which I can imagine is not the way to go:

Volkswagen - Polo
Volkswagen - Passat
Volkswagen - Golf

Hi @Timon,

Create a data type for Brand and another type for Model.

Brand

  • name (text)

Model

  • name (text)
  • Brand (Brand)
  • Year built (number)

Search box searches all brands. The dropdown displays models, which you would set up to be a search for models with a constraint of Brand = Search box’s value.

You can filter down the Models by year a number of ways depending on how you want the UI to go, but see if the above gets you started.

Try that!


Gaby | Coaching Bubble

Hi Gaby, thanks for your response!

Now that I have that part figured out, I was wondering whether there is an easier way to organize it, using lists or something.

In the model type, should I, taking volkswagen as an example again, enter all these things seperately?

Brand - Model
Volkswagen - Polo
Volkswagen - Golf
Volkswagen - Polo Bluemotion

Or can I just insert the brand volkswagen one time, followed by a list of all the models in one cell only?

Brand - Model
Volkswagen - Polo, Golf, Polo Bluemotion

I feel it would be more organized this way.

Thanks a lot!

Good question. Ok, if you ever need to search Models by something other than brand or name, like their year for example, then you do need to make Model a separate type and add each Model as it’s own record.

If you’d rather have each model be listed out for each Brand, you can have a list field under the Brand type that is either type text to store a list of Model names OR type Model to store a list of Models. I’d prefer the latter because you have more flexibility with searches and can always expand Model details. This gives you a two-way cross-referencing of the brands and models because your searches can either be what I already explained in my earlier response or they can be “brand’s list of models”

I personally would not want that list field to be a list of Model names (text) because you create much more room for error; Model names could be misspelled in some lists… AND if you’re going to have a Model type anyway to store year or anything else, then it makes much more sense for the Brand to have a list field of Models (the type).

Does this help?

Yeah, I think I´m almost there. Just can´t really grasp my head around using brand [quote=“romanmg, post:2, topic:11775”]
Model- name (text)- Brand (Brand)
[/quote]

you mentioned earlier.

Does this cause that when you insert a brand differently then known by the database it won´t get accepted? Or instead it will add this new brand value to type brand as well? Why not just use text over there?

Thanks again for the quick replies!

When you make a field’s type one of your other data types, the value of that field is actually the entire record. So not only would you be able to create an expression path to the Brand’s name, but also its other fields as well. I think another huge benefit of this is that if for whatever reason a Brand’s name is modified, then you’re only making that change once and any Models that reference that record are already updated because the name is part of the Brand record, not the Model record(s).

Assigning a brand that doesn’t exist in your database means that you would need to create the new brand record first and then save it as a value to whatever Model. You can still use a Search box element to do this if you check “allow entries not in list” so that you can create the appropriate workflows.

I know there are a few steps involved to make all of this happen. But let me know if you’re still not understanding the concept of a custom type being the type of a field.

1 Like