Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Compare Two Collections - Return Newest Time to Gallery

(1) ShareShare
ReportReport
Posted on by 278

col_Display is my main collection.

I want to compare it to vAssignmentList

col_Display has a column called Title, that will match a column in vAssignmentList called 'Assigned To'.

For example, EngineerA could have three entries in vAssignmentList, with different 'Accept Time'.

I want to find all entries for EngineerA in vAssignmentList, and in my gallery, show the newest Accept Time.

I did something similar yesterday using As Source and that worked, but I am not able to get this to work.

CoPilot gave me this code:

ClearCollect( 
    col_Display, AddColumns(
        col_Display4 As Source, 
    GroupBy(vAssignmentList,'Assigned To'.Value,"EngineerGroup"), 
    NewAssignTime, 
    First(SortByColumns(EngineerGroup, 'Assignment Time', 
    Descending)).'Assignment Time'))

Couple of things here. Right off the bat, with using GroupBy(vAssignmentList....... It is not finding anything in vAssignmentList for some reason.

Another issue is copilot was telling me to get the newest time I then need to do another Lookup. I dont think this will work for me. I need to find the newest time and stamp that into the collection.

Then on my lable in the gallery, I would use ThisItem.NewAssignTime so I can sort the gallery based on that.

I had a kind of similar issue yesterday and the help I got is the example below which is what I am trying to implement as well on this one:

ClearCollect( 
    col_Display3, AddColumns(
        col_Display2 As Source, 
    CasesAssignedToday, CountIf(vAssignmentList, 'Assigned To'.Value = Source.Title)));
  • WarrenBelz Profile Picture
    146,594 Most Valuable Professional on at
    Compare Two Collections - Return Newest Time to Gallery
    Just following up to see if you received the answer you needed, or if you require further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    146,594 Most Valuable Professional on at
    Compare Two Collections - Return Newest Time to Gallery
    I am not sure of your field types here but assuming both 'Assigned to' and Title are Text.
    With(
       {
          _Times:
          AddColumns(
             GroupBy(
                Sort(
                   vAssignList,
                   'Assignment time',
                   SortOrder.Descending
                ),
                'Assigned to',
                Grouped
             ),
             Lastest,
             First(Grouped).'Assignment time'
          )
       },
       ClearCollect(
          NewCollection,
          AddColumns(
             col_Display,
             LastAssigned,
             LookUp(
                _Times,
                'Assigned to' = Title
             ).Latest
          )
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,594 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard