cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarcoLotscherNC
Level: Powered On

Relate Multivalue Combobox

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Relate Multivalue Combobox

Hi @MarcoLotscherNC ,

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Community Support Team
Community Support Team

Re: Relate Multivalue Combobox

Hi @MarcoLotscherNC ,

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
MarcoLotscherNC
Level: Powered On

Re: Relate Multivalue Combobox

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.

MarcoLotscherNC
Level: Powered On

Re: Relate Multivalue Combobox

 I did not yet try the idea with renaming the column. But I'll do that soon...


Community Support Team
Community Support Team

Re: Relate Multivalue Combobox

Hi @MarcoLotscherNC ,

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:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-relate-unrelate#many...

 

Pleaase consider take a try with above solution I provided, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MarcoLotscherNC
Level: Powered On

Re: Relate Multivalue Combobox

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Users Online
Currently online: 393 members 2,999 guests
Please welcome our newest community members: