Hi,
So I have this aggregate that looks like this:
I need this aggregate in order to show results in a dropdown aggregate.
Within that dropdown I would like to see only the unique Ingredient Names, except those already present for the Recipe. I have a RecipeId input parameter.
2 examples to clarify:
For RecipeId 48 the dropdown should show:
Ingredient01Ingredient02Ingredient03Ingredient04Ingredient05Ingredient06 (only once)Ingredient07Ingredient11Ingredient12
For RecipeId 40 the dropdown should show:
Ingredient01Ingredient02Ingredient03Ingredient04Ingredient05Ingredient07Ingredient08Ingredient09Ingredient10Ingredient11Ingredient12
But I am at a loss at how to achieve it. It can't be that hard but I have been staring at it for too long.
EDIT: To clarify my requirements:- The names in my list should be unique (so the names of the ingredients can only appear in the list once, like what happens if you group a value).- If input parameter RecipeId = IngredientIndex.RecipeId then ingredients already coupled to that recipe should NOT show in the list. Not even when said ingredient is also coupled to other recipes and therefore occurs multiple times in my aggregate.
Ok, I see. Then, try the following
What you need to do is change the condition of your left join. When you join the Igridient Entity, with your many to many Entity, the IgridientIndex, you will need to have a condition that says "Igridient.Id = IgridientIndex.IgridientId AND IgridientIndex.RecipeId = RecipeId (Your Input Parameter).
Then, in your filters, you will put the condition: IgridientIndex.IgridientId = NullIdentifier().
I will explain what happens.
When you left join the IgridientIndex Entity, it will bring all the attributes of the Entity Igridient, even if they are on the IgridientIndex Entity or not. Then, when you add the "IgridientIndex.RecipeId = RecipeId", all the igridients still remain even if they are in the RecipeId that you choose or not. But if they aren't, they don't have values, the values are null, so what you need to do is the final filter: "IgridientIndex.IgridientId = NullIdentifier()", so you can see the Igridients that are null, and those are the unique Igridients that are not in the recipe.
Try it and let me now if it works.
Hope I helped.
Cheers.
Hi Danique,
Not totally sure if I understood your requirement but if you just want to remove duplicates from your dropdown, you can just group the attributes id and IngredientName.
Right-click on those columns inside the aggregate and group:
Then adjust the dropdown accordingly to these newly grouped attributes.
Let us know if that does the trick or if you are looking for something else.
Regards,
PZ
Hi Paulo,
I was thinking along a similar line. Once grouped, however, I'd like to remove all grouped ingredients if the input parameter RecipeId occurs for that group. So for the example below if recipeID = 40, then group "Ingredient06" does not show and if recipeID = 48, then groups Ingredient08/09/10 don't show
If you want to show in the dropdown only the ingredients that are on the recipe that you choose previously, you will just need to add a filter where Igridient.RecipeId = RecipeId (the input parameter).
You will have to choose the recipe previously, maybe in another dropdown or something who has the variable as the recipeId, and then in the "On Change" event, you will create an action where you will refresh the aggregate of igridients. This way when you choose a different recipe, in the dropdown of igridients it will appear only the igridients of the choosen recipe.
Hope I helped, if you have more doubts, let me now.
Hi Mauro,
That is not what I want to do. I want to have list of ingredients that are NOT on the recipe. It would not be enough to filter recipeId <> ingredientindex.recipeid, since an ingredient could be coupled to multiple recipies.
Therefore the ingredients listed should be unique based on name (which grouping them would achieve) AND if recipeID = ingredientindex.recipeID then the (grouped) name should not appear within the list.
Hope that clarifies my meaning
Thanks a bunch! This is exactly what I needed and your explanation made it so much more comprehensible.