Jump to content
Sign in to follow this  
samuel@felfel.ch

Sorting text based on values

This topic is 2058 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi

 

I have a problem with sorting. I need this to properly create food labels.

 

A certain product (e.g. chicken sandwich) contains several ingredients (Chicken, Butter, Tomato, Wheat, etc.). These ingredients have to appear on the food label in descending order based on their weight.

 

Amongst others, I have a table called "Recipe" with the fields "Product Name", "Ingredient", "Amount in g". Here, I add all the ingredients of a certain product together with the corresponding amount (in grams) of each ingredient. There is also another field in this table called "Ingredient_Label_List_S", which is a statistics field that sorts all the ingredients of a product (e.g. chicken sandwich) in descending order based on the field "amoung in g".

 

So far so good...however, i need the information "Ingredient_Label_List_S" in another table called "Products". In the table "Products" I have a field where I enter the formula "=Recipe::Ingredient_Label_List_S". The problem is, that in this field the ingredients are no sorted anymore. 

 

How can I solve this issue?

 

Thanks

Sam

Share this post


Link to post
Share on other sites

I am having trouble following your description. How exactly is the field called "Ingredient_Label_List_S" defined - and why is it in the Recipe table? Some more background is needed here, esp. what do your tables represent (your naming seems to be a little off) and what are the relationships between them.

 

 

My guess is that if you sort the relationship between Products and Recipe on the Recipe side by "Amount in g", descending, then a calculation field in Products =

Substitute ( List ( Recipe::Ingredient ) ; ¶ ; ", " )

will get you the list you're looking for.

Share this post


Link to post
Share on other sites

Why don’t you attach a copy of your file. Just follow the steps found here.  Attach File

Share this post


Link to post
Share on other sites

Shouldn't this simply be a structure like

 

Recipes --< Ingredients >-- Products

 

where amount is an attribute of an ingredient join table record?

 

Then create a textual description in Ingredients (Product::name & ": " & amount & "g" = e.g. ”Chicken: 200g”);

sort the Ingredients TO via Products by amount, descending;

and use Substitute ( List ( Ingredients::cDescription ) ; ¶ ; ", " ) to generate a label list sorted by amount.

  • Like 1

Share this post


Link to post
Share on other sites

This topic is 2058 days old. Please don't post here. Open a new topic instead.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.