Hi
I would like to relate all selected values from a multivalue combobox in a canvas app with a selected item in a gallery.
I tried the following:
ForAll(combobox1.SelectedItems,Relate(Gallery1.Selected.Articles,Article))
> Invalid argument type. Expecting a record value instead.
Then I tried this:
ForAll(combobox1.SelectedItems,Relate(Gallery1.Selected.Articles,{ArticleID: ArticleID, ArticleName: ArticleName}))
> Relate cannot be a literal reord.
Any ideas how to solve this?
Solved! Go to Solution.
Hi @Anonymous ,
Could you please share a bit more about the data source you used within your app? Are they CDS Entities?
Could you please share more details about the formula you typed within the Items property of the ComboBox?
I assume that your Gallery connects to Entity1, and your ComboBox connects to Entity2, the Entity1 has a One-to-Many relationship with the Entity2, is it true?
Basd on the formula you provided, I think there is something wrong with it. Please consider modify your formula as below:
ForAll(
RenameColumns(combobox1.SelectedItems, "ArticleID", "ArticleID1"),
Relate(Gallery1.Selected.Articles, LookUp(Articles, ArticleID = ArticleID1 ))
)
Note: The Articles represents the CDS Entity your ComboBox control connects to.
More details about the Relate function, please check the following article:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-relate-unrelate
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
Hi @Anonymous ,
Could you please share a bit more about the data source you used within your app? Are they CDS Entities?
Could you please share more details about the formula you typed within the Items property of the ComboBox?
I assume that your Gallery connects to Entity1, and your ComboBox connects to Entity2, the Entity1 has a One-to-Many relationship with the Entity2, is it true?
Basd on the formula you provided, I think there is something wrong with it. Please consider modify your formula as below:
ForAll(
RenameColumns(combobox1.SelectedItems, "ArticleID", "ArticleID1"),
Relate(Gallery1.Selected.Articles, LookUp(Articles, ArticleID = ArticleID1 ))
)
Note: The Articles represents the CDS Entity your ComboBox control connects to.
More details about the Relate function, please check the following article:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-relate-unrelate
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
Hi,
The special thing might be, that I'm using many-many relationship. Though there's no lookup column available. Relating just one Article works perfectly fine. That's why I tried it with the "ForAll" function.
I did not yet try the idea with renaming the column. But I'll do that soon...
Hi @Anonymous ,
Have you taken a try with the solution I provided above?
Actually, the Many-to-Many relationship is also a one-to-many or many-to-one relation between two different Entities. If you want to relate the record through the Mant-to-Many relationship, I think the Many-to-Many relationship sample within the following article would be helpful in your scenario:
Pleaase consider take a try with above solution I provided, then check if the issue is solved.
Best regards,
Hi Kris Dai
I have tried it and it worked well.
So finally renaming the column was the key to the solution.
Many thanks. I would never have had this idea by myself.
Best regards,
Marco
User | Count |
---|---|
19 | |
9 | |
8 | |
5 | |
5 |
User | Count |
---|---|
32 | |
29 | |
18 | |
18 | |
6 |