2 Replies Latest reply on Jun 1, 2016 11:39 AM by Heidelberg

# How to display in a portal all children of a parent?

I have a table with recipes and one with the about 500 records for ingredients. The ingredients list all nutrition-data and the price. The recipes contain up to 20 lines showing all ingredients in different order (i.e. in one eggs may be in the first line and in the next eggs might be in the fifth line).

The recipes-side has pull-downs in each line offering all ingredients for selection. Once I have selected a particular ingredient all related data is shown in the respected columns like for „Calories“, „Fat“, or „Cost/unit“. With a sum-function I can see for example the total calories or cost of a meal. I wonder if it was possible to show in a portal all recipes which for example require chopped almonds. At first I thought that must be simple but than I realized, that this was only possible if I had a firm kind of matrix per recipe where for example flour would always correspond with field #234. But that would make it difficult to display/read the individual recipes.

So far I only found the suggestion to use a third "join" table (https://community.filemaker.com/thread/117213?q=How%20to%20display%20in%20a%20portal%20all%20children%20of%20a%20parent? ).

Is there still another way to handle that?

• ###### 1. Re: How to display in a portal all children of a parent?

Heidelberg wrote:

So far I only found the suggestion to use a third "join" table (https://community.filemaker.com/thread/117213?q=How%20to%20display%20in%20a%20portal%20all%20children%20of%20a%20parent? ).

Is there still another way to handle that?

Not really – that is the most efficient and flexible way to handle many-to-many relationships, which is what you have – a recipe requires many ingredients, an ingredient can appear in many recipes. Every other approach is simply not worth mentioning.

I wonder how you did this now …

Heidelberg wrote:

The recipes contain up to 20 lines showing all ingredients in different order (i.e. in one eggs may be in the first line and in the next eggs might be in the fifth line).

What is a “line”? Do you use repeating fields?

Note that a join table will simplify things, because now every occurrence of a ingredient in a recipe has its own identity and can be attributed differently – for this recipe you need 200 g of almonds, but for that one you need 100 g. Also, using a list layout with all related join table records of a recipe is a simple way to print a check/shopping list (which you can sort by any attribute of the ingredient and/or its parents).

• ###### 2. Re: How to display in a portal all children of a parent?

Sorry - I should have said „rows“ not lines.

The reason I have created the file in the first place was to document my daily calories, protein and some other nutrition critical for my heart condition. The nutrition data are collected from the internet and entered in the „Zutaten“-Table (Ingredients).

The second table „Speisen“ (recipes)  is related to the ingredient-table. The links are the names of the ingredients. They determine which details are shown in their row

The third table „Mahlzeiten“ (meals) gets its input from the recipes-table. Here I have for breakfast, lunch and dinner 5 rows each. Depending on the recipe selected for a given row the nutrition data is copied/pasted in the respective field using individual scripts.

Originally I had defined also here dynamic links but the updating process after entering data in one single field slowed down FMP quite a bit. Besides - certain functions work only if a field contains text and not a formula or link. The file is already a little cluttered because I have adjusted for example what columns are shows several times.

It’s not comparable to neat commercial apps which help you monitor your health-related data. But I prefer driving a car with a shift stick and not with an automatic where I cannot „see“ all details (still more common in Germany). And as said - I need to adjust the database from time to time.

Hope that my first attempt to attach a file will work