web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collection not collect...
Power Apps
Answered

Collection not collecting a LookUp to another list

(0) ShareShare
ReportReport
Posted on by 17

Power Apps Community,

 

I have two SharePoint lists that are connected by IDs that track a time entry and an associated tag in the Title column:

 

TimeEntries.ID = TimeEntryTags.TimeEntryID

 

I have a created collections for both of these lists using the same date filters where VarUserName is the Full Name of the user and StartTimeAsNumber is the date as a number in yyyymmdd format:

 

ClearCollect(EntriesCol1, Filter(TimeEntries, Title = VarUserName, StartTimeAsNumber >= Value(FilterByStartDateInput_1.Text)));

 

ClearCollect(TagsCol1, Filter(TimeEntryTags, 'Full Name' = VarUserName, StartTimeAsNumber >= Value(FilterByStartDateInput_1.Text)));

 

Next, I want to create a new collection which has the Tag associated with the TimeEntry.

 

ForAll(EntriesCol1, Collect(EntriesWithTagCol2, {TimeID: ID, Tag: LookUp(TagsCol1, TimeEntryID = ID).Title}));

 

For some reason, the Title column of TagsCol1 does not transfer to the new collection EntriesWithTagCol2.

 

I can use a gallery to display EntriesCol1 and then use a LookUp in a Label to get the associated tag in the Title column:

 

Label.Text within Gallery = LookUp(TagsCol1, TimeEntryID = ThisItem.ID).Title

 

I can also hard code labels with the matching IDs to get the Title column:

 

LookUp(TagsCol1, TimeEntryID = 118).Title

 

Why can I not get the ForAll(EntriesCol1 statement to work with the LookUp to get the Title column from TagsCol1?

 

I would really appreciate some help. I've spent a lot of time banging my head against a wall trying to figure this out.

 

Thank you!

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ltd224 

    Try altering your formula to the following:

    ForAll(
     AddColumns(EntriesCol1, "id", ID), 
     Collect(EntriesWithTagCol2, {TimeID: id, Tag: LookUp(TagsCol1, TimeEntryID = id).Title})
    );

     

    I hope this is helpful for you.

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @ltd224 

     

    Can you try to update the expression to:

    ForAll(EntriesCol1, Collect(EntriesWithTagCol2, {TimeID: ID, Tag: LookUp(TagsCol1, TimeEntryID = ThisRecord.ID).Title}));

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    ThisRecord is nice to use, but be cautious with it - it has some unexpected results.

  • ltd224 Profile Picture
    17 on at

    @RandyHayes

    That worked great! Any idea why I couldn't use the ID field from the List? There must be something special about it that wouldn't allow it to work.

     

    In my troubleshooting I discovered some anomalies but couldn't discover the root issue.

     

    Thanks for the help!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ltd224 

    Good news!

    It's all about ambiguity...in your first formula, you were referencing the ID of the wrong source in your Lookup.

    There are things like Disambiguation notation that can be used and other objects like ThisRecord as was also mentioned, but they sometimes do not reference what you might think.

    In the formula I gave you, we end up adding a totally different column and then specifically referencing that column in the LookUp - there is nothing ambiguous then, it's a totally different column than the other source.

  • ltd224 Profile Picture
    17 on at

    Thanks again Randy!

     

    For anyone else that views this thread, using RenameColumns still has disambiguation problems. That was one of my troubeshooting steps but still didn't work.

     

    Randy's solution works great.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard