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 / Gallery control where ...
Power Apps
Answered

Gallery control where conditions are based on card items

(0) ShareShare
ReportReport
Posted on by 78

Good day, 

Please find the below example of a gallery with 2 card items.
Is it possible to create a control where in the case of the matching Code-Items in the gallery to look at the date and depending on the date to hide the edit button for example, the oldest date range? 

 

The source of the gallery is a collection. So, in the case this is possible, do you point to the data source to do the check or the gallery? 

 

Orvyn_0-1700652187355.png

Kind Regards

Categories:
  • RodCha Profile Picture
    216 on at

    RodCha_0-1700654509015.png

    Let me know if this works for you

  • Orvyn Profile Picture
    78 on at

    Thanks @RodCha for the feedback.

    My request might have been misleading, so let me try again. 
    1. So, the first check is to see if in the gallery contains cards containing the same item code.

    2.  If yes, to look at both starting dates and to decide which is the oldest, and in the card with the oldest start date to hide the edit button.

     

    Hope the above is a better explanation? 

    Orvyn_0-1700656153009.png

    Kind regards

  • RodCha Profile Picture
    216 on at

    RodCha_0-1700659706290.png

    This is just a test that I'm trying, do you think this can work with your goal? But the edit button will be working based only with the reference of the start_date.

  • Orvyn Profile Picture
    78 on at

    @RodCha , yes it looks in line with my goal, however, a minor would be just to make the latest date range the editable one thus hiding the edit button where the oldest date is for the matching item. Many thanks for your help thus far.

  • Verified answer
    RodCha Profile Picture
    216 on at

    RodCha_1-1700662161842.png

     

    First add the 'flexible height gallery' then insert the 'vertical gallery'.

     

    Here are the formulas if you want to just copy/paste:

     

     

     

     

    RodCha_2-1700662431967.png

    ClearCollect(test_data,
     {code: "001", start: Date(2014,09,03), end: Date(2024,01,31)},
     {code: "001", start: Date(2024,02,01), end: Date(2050,09,11)},
     {code: "002", start: Date(2024,02,01), end: Date(2050,09,11)},
     {code: "002", start: Date(2024,02,01), end: Date(2050,09,11)},
     {code: "004", start: Date(2024,02,01), end: Date(2050,09,11)}
    )

     

     

     

     

    RodCha_3-1700662485392.png

    Filter(GroupBy(test_data, "code", "data"), CountRows(data) >= 1)

     

     

     

     

    RodCha_4-1700662556435.png

    With({table: SortByColumns(Filter(test_data, code = ThisItem.code), "start", SortOrder.Descending)},
    ForAll(Sequence(CountRows(
     table
    )),
    Patch(Last(FirstN(
     table,
     Value)), {RowNumber: Value})
    ))

     

     

     

     

    RodCha_5-1700662612931.png

    Self.TemplateHeight * CountRows(Self.AllItems)

     

     

     

     

    RodCha_6-1700662659475.png

     

    ThisItem.RowNumber = 1

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard