Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Filter Collection based on specific ID from a SharePoint List

(0) ShareShare
ReportReport
Posted on by 621

Trying to create a collections based on a specific field value 

Galdcp selects a specific record from  a SharePoint list 

I want to create a collection from a "child" SharePoint list that has Galdcp ID as one of its field values. looks like I'm referencing the ID correctly but the Goal filed is bulling in all the rows, not just the one for the selected ID. What am I missing?

 

ClearCollect(colfaitems,KYOJDCPFocusAreas;{DCP:galdcp.Selected.ID,Goal:KYOJDCPFocusAreas.Goal});

 

ctedesco3307_0-1681846169967.png

 

ctedesco3307_1-1681846206437.png

 

All I should be getting are the bottom 3 

 

ctedesco3307_2-1681846293467.png

 

 

Thx 

  • ctedesco3307 Profile Picture
    621 on at
    Re: Filter Collection based on specific ID from a SharePoint List

    @BCBuizer - that worked!  Thank you 

  • Verified answer
    BCBuizer Profile Picture
    21,991 Super User 2025 Season 1 on at
    Re: Filter Collection based on specific ID from a SharePoint List

    Hi @ctedesco3307 ,

     

    Instead of using the Value function, select the Value column for the DCP record:

     

    ClearCollect(colfaitems,Filter(KYOJDCPFocusAreas, DCP.Value = galdcp.Selected.ID));
  • JohnM86 Profile Picture
    590 on at
    Re: Filter Collection based on specific ID from a SharePoint List

     

    To fix this issue, you could try using the Value function to get the underlying value of the lookup field. Here's an example of how you could modify your formula to do this:

     

     
    ClearCollect(colfaitems, Filter(KYOJDCPFocusAreas, Value(DCP) = Value(galdcp.Selected.ID)))
     

    The Value function returns the underlying value of the lookup field, which should allow you to compare the two values without any issues.

  • ctedesco3307 Profile Picture
    621 on at
    Re: Filter Collection based on specific ID from a SharePoint List

    @JohnM86 Thanks - closer - but now I get an error at the = sign  - Incompatible types  for comparison These values can't be compared Record number 

     

    DCP in KYOJDCPFocusAreas is a lookup field.  I'll mess around with it a bit. thx 

    ClearCollect(colfaitems,Filter(KYOJDCPFocusAreas, DCP = galdcp.Selected.ID));

  • JohnM86 Profile Picture
    590 on at
    Re: Filter Collection based on specific ID from a SharePoint List

     

    It looks like you are using the semicolon (;) to separate the two arguments of the ClearCollect function, which is causing the second argument ({DCP:galdcp.Selected.ID,Goal:KYOJDCPFocusAreas.Goal}) to be interpreted as a separate statement instead of an additional record to include in the collection.

    To fix this, you can use the comma (,) instead to separate the two arguments, and then use the Filter function to retrieve only the items from the child SharePoint list that have the selected Galdcp ID:

     

    ClearCollect( colfaitems, Filter( KYOJDCPFocusAreas, DCP = galdcp.Selected.ID ) );
     

    This should create a collection called "colfaitems" that includes all items from the "KYOJDCPFocusAreas" SharePoint list where the "DCP" field matches the ID of the selected item in the "galdcp" gallery. The "Goal" field of each item should be included in the collection as well.

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,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard