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: