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 / The gallery condition ...
Power Apps
Unanswered

The gallery condition on the first item affects all items

(0) ShareShare
ReportReport
Posted on by 2

I created the Editable Grid in Power Apps. 

 

In my gallery, I added two date pikers and one drop-down. 

 

I want to add validation on the dropdown item property if those date piker are blank then dropdown items ["Partially Received", "Not Received"] else ["Received"] 

 

Formula - If( IsBlank(DatePicker1.SelectedDate) && IsBlank(DatePicker2.SelectedDate), ["Partially Received", "Not Received"], ["Received"] ) 

 

Issue - The gallery condition on the first item affects all items only when I am saving the gallery for the first time. After initial save it working as required.

Categories:
  • Prabhakar_S Profile Picture
    735 Moderator on at

    Hi @Jitesh1432 ,

     

    You can try using a different approach. Instead of embedding this complex logic directly in the Item property of the dropdown, you can use variables and a clearer structure. Here's how you can modify your approach:

     

    Create Variables:
    Create two variables to store the selected dates from DatePicker1 and DatePicker2. Let's call them `SelectedDate1` and `SelectedDate2`. Set these variables when the DatePickers are selected.

    Set(SelectedDate1, DatePicker1.SelectedDate);
    Set(SelectedDate2, DatePicker2.SelectedDate);

     

    Dropdown Item Property:
    In the Item property of your dropdown, use a formula that checks the variables `SelectedDate1` and `SelectedDate2` to determine the dropdown items.

    If(
    IsBlank(SelectedDate1) && IsBlank(SelectedDate2),
    ["Partially Received", "Not Received"],
    ["Received"]
    )

     

    To handle the initial state correctly, ensure that the `SelectedDate1` and `SelectedDate2` variables are set when the gallery item is created. You can set them based on the initial values of the DatePickers or use the Defaults function.

     

    For example, if you want to set `SelectedDate1` and `SelectedDate2` based on the initial values of DatePickers:

     

    Set(
    SelectedDate1,
    If(IsBlank(ThisItem.DatePicker1), Defaults(DatePicker1).SelectedDate, ThisItem.DatePicker1.SelectedDate)
    );
    Set(
    SelectedDate2,
    If(IsBlank(ThisItem.DatePicker2), Defaults(DatePicker2).SelectedDate, ThisItem.DatePicker2.SelectedDate)
    );

     

    Thanks!!!

     

    Please consider marking my response as the accepted solution if it successfully resolves your concern. If you found the information beneficial in other aspects, kindly express your appreciation by giving it a thumbs-up.

  • Jitesh1432 Profile Picture
    2 on at

    Greetings, @Prabhakar_S 


    If I use this approach. variable's structure is clear.

     

    Therefore, the first line item dropdown value changes in accordance with the second line item I selected. So I don't want to clarify the structure.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard