Forum Academy Marketplace Showcase Pricing Features

How to dynamically show certain fields (and values) depending on a custom state / input

I’m moving my database to a “flat database” for reasons I don’t really need to get into, but I’ll have fields in a data type of “Foods” such as:

Food name
Protein (amount of protein in food)
Carbs (amount of carbs in food)
Vitamin C
Nutrient Density
etc.

In my app, I have many foods to display. People are looking to show foods highest in protein - which I have the functionality to display. However, I don’t know which particular nutrient a person is going to select. If they select “protein” I want to be able to ONLY show the protein amount (“Protein” field) for that food. I don’t want to show the amount/values for all fields (e.g. “Carbs” or “Vitamin C” etc) on that one food.

I could of course use conditional statements (if they select protein, then just show protein amount), but I’m planning on having 50-75 fields that could be potential options and it seems really messy/time consuming to use conditional statements.

How can I dynamically select a field is really the question? I’m guessing that it will be using custom states and/or an input.

This question makes sense in my mind, but if doesn’t to you, please please ask some clarifying questions. Appreciate an help I can get!

Link to app:

I don’t think you’ll be able to do what you want without doing what you don’t want to do

You may try to reference this thread though

It might enable the functionality you are looking for.

Thanks - Do you know if using that many conditional statements on Bubble will severely affect performance? Or is it a generally efficient way to approach this.

I feel like there must be another way, but if that’s all there is (or perhaps trying List Shifter), then I may go with it.

I’m not sure.

I would try list shifter first…check out the thread I linked and the related example application which should put you on the right path

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