Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

What is wrong with this code? Filtering inside an IF statement

(0) ShareShare
ReportReport
Posted on by 32

Hi,

 

I'm not sure what's wrong with this statement.  It creates neither an error nor shows any sharepoint records in the gallery? I put the code inside the Items property of my gallery. 'Search Box'.Text is the text input field and I want to filter only if it's empty (and display the entire sharepoint list if not).  Can someone please help me?

 

If (
    !IsBlank('Search Box'.Text),
Filter(
    DWBExtractMigrationv1162,
    StartsWith(
        "EDG-ID", Value('Search Box'.Text)) ||
    StartsWith(
        "RequestStatus", 'Search Box'.Text
        ) ||
    StartsWith(
        "RequestType", 'Search Box'.Text)||
StartsWith(
    "Title", 'Search Box'.Text)
), DWBExtractMigrationv1162
)
  • Yogesh Murugan Profile Picture
    443 Super User 2025 Season 1 on at
    Re: What is wrong with this code? Filtering inside an IF statement

    Try this

    If(
     IsBlank(Trim('Search Box'.Text)),
     DWBExtractMigrationv1162,
     Filter(
     DWBExtractMigrationv1162,
     StartsWith("EDG-ID", 'Search Box'.Text) ||
     StartsWith("RequestStatus", 'Search Box'.Text) ||
     StartsWith("RequestType", 'Search Box'.Text) ||
     StartsWith("Title", 'Search Box'.Text)
     )
    )

    If is not search is not blank is filtered correct

  • Nehal3 Profile Picture
    32 on at
    Re: What is wrong with this code? Filtering inside an IF statement

    Hi, it's attached.

  • Yogesh Murugan Profile Picture
    443 Super User 2025 Season 1 on at
    Re: What is wrong with this code? Filtering inside an IF statement

    Can you send  screen shot and code ?

  • Nehal3 Profile Picture
    32 on at
    Re: What is wrong with this code? Filtering inside an IF statement

    Hi, it's the same thing with that code too.  No errors but shows a blank gallery

  • Yogesh Murugan Profile Picture
    443 Super User 2025 Season 1 on at
    Re: What is wrong with this code? Filtering inside an IF statement

    Try this code :

    If(
     IsBlank('Search Box'.Text),
     DWBExtractMigrationv1162,
     Filter(
     DWBExtractMigrationv1162,
     StartsWith("EDG-ID", 'Search Box'.Text) ||
     StartsWith("RequestStatus", 'Search Box'.Text) ||
     StartsWith("RequestType", 'Search Box'.Text) ||
     StartsWith("Title", 'Search Box'.Text)
     )
    )
  • Nehal3 Profile Picture
    32 on at
    Re: What is wrong with this code? Filtering inside an IF statement

    I meant I want to filter it if the text box is not empty and show the entire list if it is empty!

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard