cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
morall
Microsoft
Microsoft

Filtering using Len in a gallery

Works:

Sort(Filter('Pipeline Candidates', Len(Gallery1.Selected.'Candidate Summary')<50), 'Created On', Descending)

 

that works, but switching the sign to > doesn't

 

Doesn't work:

Sort(Filter('Pipeline Candidates', Len(Gallery1.Selected.'Candidate Summary')>50), 'Created On', Descending)

 

Any reason why?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@morall 

I'm not sure what you are trying to actually filter, but you are only basing your filter on ONE item.

    Sort(Filter('Pipeline Candidates', Len(Gallery1.Selected.'Candidate Summary')<50), 'Created On', Descending)

That one item is the value of the Candidate Summary of the currently selected item in your Gallery.

So, if that ONE item is a length of less than 50, then the result is true for every record.  If you switch the sign, the statement will evaluate to false...and you'll have no records.

 

I believe you want this instead:

Sort(Filter('Pipeline Candidates', Len('Candidate Summary')<50), 'Created On', Descending)

 

I hope this helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@morall 

I'm not sure what you are trying to actually filter, but you are only basing your filter on ONE item.

    Sort(Filter('Pipeline Candidates', Len(Gallery1.Selected.'Candidate Summary')<50), 'Created On', Descending)

That one item is the value of the Candidate Summary of the currently selected item in your Gallery.

So, if that ONE item is a length of less than 50, then the result is true for every record.  If you switch the sign, the statement will evaluate to false...and you'll have no records.

 

I believe you want this instead:

Sort(Filter('Pipeline Candidates', Len('Candidate Summary')<50), 'Created On', Descending)

 

I hope this helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

oh my god, sometimes when you get buried in the weeds you miss seeing the picture. 

 

thank you

when I try this with Sort() it works fine, but SortByColumns is throwing an error. In the suggestion box its suggesting using As, exactin, in and not <, > etc

 

SortByColumns(
    Filter(
        pipeline_candidates,
        Switch('Yrs of Exp drpdown'.Selected.Value,            
            "2-5 yrs", 'Years of experience' >= 2 && 'Years of experience' <= 5,
            "6-9 yrs", 'Years of experience' >= 6 && 'Years of experience' <= 9, 
            "10+ yrs", 'Years of experience' >= 10,
            true
        ) &&

        (search_box.Text in Name Or search_box.Text in 'Candidate Summary' Or search_box.Text in 'Candidate Details')

        && 

        PipelineTemplate.Name = 'pipeline drpdwn'.Selected.Result
        &&
        Switch(drpFastPass.Selected.Value, "Yes", Text(FastPass) = "Yes", "No", Text(FastPass) = "No", true)
        &&
        Len(pipeline_candidates.'Candidate Details') > 50  
        ## error is showing on the > symbol
        &&
        If(
            drpLocation.Selected.Value = "All", 
            true,
            drpLocation.Selected.Value in Concat('Desired Location'.Value, Value & ", "))
    ),
    "createdon",
    Descending
)

 

That makes me think Len(pipeline_candidates.'Candidate Details') is returning a list instead of a number?  

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

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

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,095)