cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RMeena_9
Resolver I
Resolver I

How to create a effective search option for overall gallery items irrespective of tabs selection filters ??

Hello Guys,

 

I have a code which says to filter according to the selected tab as shown in screenshot (Alive projects, Closed Projects, All Projects).

I also want to filter the gallery as per the column names (shown in same screenshot) so at the end of the if function I wrote something highlighted in RED. 

When I select any three tabs, the code works fine but when I try to search any column items using SearchBar_2 text input it is not at all working even for single column items search.

DataSource:- Project_Table (Excel)

 

If(
    varAliveP = true && varClosedP = false && varUpcMilP = false,
    Filter(Project_Table,Alive_Project = "Yes"),
    If(
    varAliveP = false && varClosedP = true && varUpcMilP = false,
    Filter(Project_Table,Alive_Project = "No"),
    If(
    varAliveP = false && varClosedP = false && varUpcMilP = true,
    Project_Table,
        If(IsBlank(SearchBar_2.Text&&
        varAliveP = true || varAliveP = false ||
        varClosedP = true || varClosedP = false ||
        varUpcMilP = true || varUpcMilP = false,
        Project_Table,Filter(Project_Table,StartsWith(Customer,SearchBar_2.Text)))
    ))
)
 
Please Help me in modifying this code. How can I use both search option and tabs in a same screen. Do I have to create search option for individual tabs ?? how can I make it generic ?? I can't use normal search function since my data source is excel.
 
I badly need help to finish this task!!!
 
Thank you in advance
1 ACCEPTED SOLUTION

Accepted Solutions

Hello @iAm_ManCat,

 

Thankyou so much for your support it worked pretty well 🙂 🙂

I am so happy 

Only problem is it is showing delegation error (blue highlight near || (OR) in the code  between Len and StartsWith)

 

Will it be ok ?? my data source has around 80 rows with above mentioned columns in screenshot.

View solution in original post

4 REPLIES 4
iAm_ManCat
Super User
Super User

Hi,

 

It's best to not nest your if statements inside each other, you can add them on as additional 'else if' conditions as I have done below. Additionally, we can include the filtering by textbox by including it with each filter but only searching where the text is more than zero characters (there are minor bugs with IsBlank where it doesnt always detect it as blank)

 

 

If(
    varAliveP = true && varClosedP = false && varUpcMilP = false,
    Filter(
            Project_Table,
            Alive_Project = "Yes",  
            //Either there is no text in the searchbox  or else we start to filter by the text
            (
                Len(SearchBar_2.Text)=0
                || 
                StartsWith(Customer,SearchBar_2.Text)
            )
    ),

    varAliveP = false && varClosedP = true && varUpcMilP = false,
    Filter(
            Project_Table,
            Alive_Project = "No", 
            //Either there is no text in the searchbox  or else we start to filter by the text
            (
                Len(SearchBar_2.Text)=0
                || 
                StartsWith(Customer,SearchBar_2.Text)
            )
    ),

    varAliveP = false && varClosedP = false && varUpcMilP = true,
    Filter(
            Project_Table, 
            //Either there is no text in the searchbox  or else we start to filter by the text
            (
                Len(SearchBar_2.Text)=0
                || 
                StartsWith(Customer,SearchBar_2.Text)
            )
    ),
    //Catch-all where none of the above conditionsis true and we only filter by searched text if it exists
    Filter(
            Project_Table, 
            //Either there is no text in the searchbox  or else we start to filter by the text
            (
                Len(SearchBar_2.Text)=0
                || 
                StartsWith(Customer,SearchBar_2.Text)
            )
    )
)

 

 

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Hello @iAm_ManCat,

 

Thankyou so much for your support it worked pretty well 🙂 🙂

I am so happy 

Only problem is it is showing delegation error (blue highlight near || (OR) in the code  between Len and StartsWith)

 

Will it be ok ?? my data source has around 80 rows with above mentioned columns in screenshot.

Yes the default delegable limit is 500 and you can increase this in the App settings to 2000, so your 80 rows falls far underneath the limit

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Thank you

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (3,106)