Take either your existing relationship on which your portal is based or make a new occurrence of the portal's table and related it in the same way. Either way, specify a sorted order for the relationship that matches the descending order you want for your list of ingredients. If this sort order is acceptable for your portal, use the original relationship. If that would mess up your list of ingredients in the portal, use the duplicated table occurrence so that your portal's order is unchanged (or specify a sort order for the portal in portal setup...).
Then this calculation will return your sorted list of ingredients:
Substitute ( List ( SortedTableOccurrence::IngredientField ) ; ¶ ; ", " )
To specify a sorted order for a relationship:
Open Manage | Database | Relationships and find the relationship line for the relationship.
Double Click It.
Click the sort check box for the table you want to have a sorted order and specify your sort order.
A sorted relationship will affect:
- The order of records in an unsorted portal
- The order of records pulled up by a go to related records step
- The order of values returned by the List function
- Which record is returned by the Last function.
- Which record returns a value to a direct reference to the related table such as RelatedTable::Field
That worked perfectly except for sorting.. I'v attached a screenshot of the relationship graph and the sorting window. The trouble field is IngredientStatement, which imports the field contents from Ingredient_Description_en and hope to get it sorted by percent.
Im sure its something simple and that i'm just not seeing it...
Thanks for the help,
If you want the Ingredient_Product records listed in descending order by percentage that should work--provided that Percentage is either a number field or a calculation field with "number" specified as the return type. I'm assuming you want to define the List function as a calculation field in Product or in a script step that is performing with a Layout based on Product as the current layout.
I suspect though that you tried to list records from Ingredients. I don't know if the sort order as specified here would work in that case or not--haven't tested that variation. If you are trying to list a name field from Ingredients, try this and see if it works: Define a calculation field in Ingredients_Products defined as: Ingredients::Name_en. Then refer to this field in your list function.
Actually I'm wanting the Description_en from INGREDIENTS sorted by percentage in INGREDIENTS_Products and store it in PRODUCTS...
I suggest following my suggestion for a calculaiton field, but use Description_en instead of Name_en in the calculation.
AWESOME!!!! You Rock!! Works like a champ!