cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

If Gallery.Selected.Value is equal to certain rows in a table then ...

Hello everyone, 

 

I have two Common Data Service (CDS) tables Tray and Plant respectively. Currently in my solution Tray table is displayed in a gallery. When I select an item in this gallery (Gallery.Selected.Name) I want to check how many of the records in the Plants table have the same value (for column Plants.TrayName) as the one that's selected in the gallery. Then for all the records that have Gallery.Selected.Name = Plants.TrayName I want to add these records to a new collection. 

 

So far I've tried ForAll(Plants, If(Gallery1.Selected.Name in Plants.TrayName, <action where this row is added to a collection>)) but this gives me error "Invalid schema, expected one-column table" that points to Plants.TrayName.

 

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @ManfredsMertens ,

This will collect one field - just add the others as required

ForAll
   Filter(
      Plants,
      TrayName = Gallery1.Selected.Name
   ),
   Collect(
      YourCollection,
      {Tray:TrayName}
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
Super User III
Super User III

Hi @ManfredsMertens ,

This will collect one field - just add the others as required

ForAll
   Filter(
      Plants,
      TrayName = Gallery1.Selected.Name
   ),
   Collect(
      YourCollection,
      {Tray:TrayName}
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Thanks bro! 

I just noticed that this code doesn't import it in the right order. Lets say I have 4 records. By looking at the ID of the new collection it gets imported 1,2,4,3. Any idea why?

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (9,175)