Creating a text string from more than 1 database value with different formatting

Hi guys,

I’m loving Bubble so far, but I’m struggling to get a certain feature in my app working.

I’m building a recipe application and one of the features is to list the ingredients with their allergens (in bold) to look like the following:

Whey Powder (Milk), Butter (Milk), Almonds (Nuts), Baking Powder, Apples, Strawberries.

The above will consist of ingredient names and ingredient Allergens (If they exist), but in brackets and in bold.

Database table for ingredient looks like this:

Name: text
Calories: number
Carbs: number
Fats: number
Protein: number
Allergens: List of Allergens

The Allergens Table is:
AllergenName: text

I can easilly display (without the allergens) into a text field with the following:

1

My question is. When I’m looping through the ingredients, how do i add the allergens? And also make them bold and in brackets. It seems like I need to do some wizardry to get this working.

Many thanks,

Martin

Once you have your list of Ingredients, add :format as text.
Then you can use a combination of
Ingredient's Name
Ingredient's Allergins :count
>= 1
:formatted as text
:join with
[b] and [/b] (bb-code)

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