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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Pull matching values o...
Power Apps
Unanswered

Pull matching values of the records in SP list

(0) ShareShare
ReportReport
Posted on by 144

ClearCollect(

CollectionCode,

ForAll(

Distinct(

Filter(

CollectionA),Group),

Lookup(ListA,

columnA = Value

).columnB));

 

 

The above formula fetchs only one record that matches the criteia. But need to pull all the records that matches the value.

THanks.

Categories:
I have the same question (0)
  • SpongYe Profile Picture
    5,603 Super User 2025 Season 2 on at

    Hi @HarishaAkkil 

     

    try this:

    ClearCollect(
     CollectionCode,
     ForAll(
     Distinct(Filter(CollectionA),Group),
     Filter(ListA, columnA = Value).columnB // Changed to Filter
     )
    );

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • realwillwright Profile Picture
    772 Moderator on at

    Hi @HarishaAkkil 

     

    From what I can tell of the code, you are trying to create a collection of values columnB. Doing this by filtering CollectionA and getting all unique values of the column 'Group' then doing a lookup on ListA, where columnA equals the unique value 'Group'. 

     

    How many distinct values of Group are there?

     

    ClearCollect(
     CollectionCode,
     ForAll(
     Distinct(
     Filter(
     CollectionA,
     1=1
     ),
     Group
     ),
     Lookup(
     ListA,
     columnA = Value
     ).columnB
     )
    );
  • HarishaAkkil Profile Picture
    144 on at

    Hi @SpongYe ,

    Getting error saying incompatiable type. The collection can't contain this value.

    Please help.

    Thanks.

  • SpongYe Profile Picture
    5,603 Super User 2025 Season 2 on at

    Hi @HarishaAkkil 

     

    Change the order of the Forall en Collect so you can loop through the items and collect the record into the collection. 

    ForAll(
     Distinct(CollectionA, Group),
     Collect(
     CollectionCode,
     LookUp(ListA, columnA = ThisRecord.Value).columnB
     )
    )

     If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • HarishaAkkil Profile Picture
    144 on at

    No doesn't work as expected, resulting the same output.

  • Verified answer
    realwillwright Profile Picture
    772 Moderator on at

    @HarishaAkkil 

     

    it looks like the collection is outside of the forall, I've moved the collection around and removed the distinct. The distinct can be added back in if required.

     

    Clear(CollectionCode);
    ForAll(
     Filter(
     collectionA,
     1=1
     ) As dataLoad,
     Collect(
     CollectionCode,
     LookUp(
     ListA,
     dataLoad.<columnname> = columnA
     ).columnB
     )
    );



    -------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • HarishaAkkil Profile Picture
    144 on at

    Using Lookup fetches only one data that matches in the List A, But List A has many records that has same name as DataLoad. Is there any other way to rewrite it by avoid using LookUp?

  • HarishaAkkil Profile Picture
    144 on at

    Hi @realwillwright ,

    Instead of Lookup I used Filter. It did worked. Thank you so much. You are really 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard