cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarcoLotscherNC Advocate I
Advocate I

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
Community Support

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
Community Support

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 Advocate I
Advocate I

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 Advocate I
Advocate I

Re: Relate Multivalue Combobox

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


Community Support
Community Support

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 Advocate I
Advocate I

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Users online (8,242)