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 / UpdateContext only if ...
Power Apps
Answered

UpdateContext only if variable isn't blank

(0) ShareShare
ReportReport
Posted on by 13

Hello, I hope someone can help me. I am trying to build a search function into my app. I have several dropdown's to filter the main gallery. I have the OnChange of the dropdown set up to store the value in a variable. If I reset the dropdown, the variable is cleared and shows "no value" on the variables view. This part works perfectly.

 

I am trying to add a button that will apply the filters but only if the variable is blank. 

 

Not(
 IsBlank(sregion,
 UpdateContext({localprojects:Filter(localprojects,textregion=sregion)
 })
 )
)

 

sregion is the variable that is set by the dropdown, or blank if not changed.  I am trying to get the UpdateContext to run only if sregion holds a value. 

 

I would greatly appreciate any and all assistance.

Thank you.

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,942 Most Valuable Professional on at

    Hi @PeterBayliss ,

    Try

    If(
     !IsBlank(sregion),
     UpdateContext(
     {
     localprojects:
     Filter(
     localprojects,
     textregion=sregion
     )
     }
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • PeterBayliss Profile Picture
    13 on at

    Thank you for the very quick answer. It worked perfectly.

     

    It is my understanding that "NOT( ISBLANK(" is the same as "!ISBLANK".

     

    Was this just me getting languages mixed up?

  • WarrenBelz Profile Picture
    156,942 Most Valuable Professional on at

    HI @PeterBayliss ,

    No - you can use either - same as && for And() and || for Or(). The below would work as well.

    If(
     Not(
     IsBlank(sregion)
     ),
     UpdateContext(
     {
     localprojects:
     Filter(
     localprojects,
     textregion=sregion
     )
     }
     )
    )

     

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 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard