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 / Compare all items in G...
Power Apps
Answered

Compare all items in Gallery to check for the same ID or Blank

(0) ShareShare
ReportReport
Posted on by 178

I've spent the last 1.5 working days trying to search the forums, but I am yet to find something that works for me.

I have a collection where I am trying to check whether all IDs in the collection are either the same or blank - if not, then it cannot continue.

The app can consolidate different items together - however, the I'm experiencing is that I cannot figure out how to compare the ConsolidationID to each other.

 

Example for 3 items:

Title        |   ConsolidateID

A             |       ABC

B             |       ABC

C             |       CBA

 

If the button to consolidate these titles together, a notification would appear, but let's say that the ID for C is blank, then it would consolidate the items (the consolidation ID is auto-generated in the app).

I just cannot figure out how to compare all the different IDs to each other.

Any help would be greatly appreciated!

Categories:
I have the same question (0)
  • Bilakanti Profile Picture
    1,226 on at

    @AlexTheKiddCan you try using GroupBy

     

  • AlexTheKidd Profile Picture
    178 on at

    Hi @Bilakanti ,

     

    When using GroupBy (and ClearCollect), I do get the consolidated ID's grouped together, but I'm still not sure how I can compare all the items.

    In the example below, there is 1 blank, 2 with the top ID, and 1 with the bottom - I should not be able to consolidate these, as they have to either be the exact ID, or blank.

    I guess I could count the number of items in the collection, but if I didn't have any blanks, and two different ID's, it would proceed, when it should not.

    AlexTheKidd_0-1675064703237.png

     

  • Verified answer
    AlexTheKidd Profile Picture
    178 on at

    Holy maloney... I asked ChatGDP "check if ID is the same or blank in gallery in Powerapps", which answered the following:

     

    If(CountRows(Filter(Gallery.AllItems, IsBlank(ID) || ID = First(Gallery.AllItems).ID)) = CountRows(Gallery.AllItems), "All IDs are the same or blank", "IDs are not all the same or blank")

     

    The code works, as it now compares all IDs that they are the same, or that they are blank. Here is the code I'm using, which works as it should:

    If(
     CountRows(
     Filter(
     Gallery_consolidate.AllItems,
     IsBlank(ConsolidatedID) || ConsolidatedID = First(Gallery_consolidate.AllItems).ConsolidatedID
     )
     ) = CountRows(Gallery_consolidate.AllItems),
     formula...,
     formula....
    )

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard