cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KalvisT
Helper II
Helper II

Delegation workaround, SP list with filers in choice column

Hi, 

 

I have a problem in my filter formula. It filters by user, a dropdown that has prossess we work with ( a choice column), monthY and a searchbox that can find clients with their ID. 

 

My delegation problem is in :    ) in Prossess.Value, . Is there a workaround, how could I change the formula? Might be that my dataset grows more than 2000 rows in splist. 

This is my current filter formula :

Filter(

    Kvalitet_2021,

    'Behandlet av'.DisplayName = varUser,

    Substitute(

        ddProssess.SelectedText.Value,

        "Prossess",

        ""

    ) in Prossess.Value,

    (ddMonth.SelectedText.Value = "Måned" || MånedY = ddMonth.SelectedText.Value) && TextInputSearch.Text in Kunde

)

 

Thanks a lot beforehand! 

17 REPLIES 17
KvB1
Solution Specialist
Solution Specialist

No, because you are including the non-delegatable filter in your complete filter, it will turn the whole filter non-delegatable.

 

You need the approach suggested by Stalin using With:

With({_item: Filter(Kvalitet_2021,'Behandlet av'.DisplayName = varUser)},
Filter(_item,

Also, since your choice column will only contain one value, you dont need to use 'in' but can use '=' as well.

 

Also, why do you use substitute for the process dropdown? Are the values populating the sharepoint column for this different than the values in the dropdown?

Okey, but if I use the Stalin method it doesnt work, as I showed in the reply to his comment. 

 

No, they are the same, i was just searching for answers and came upon that formula. 

I'm really new to powerapps and this is the first one i'm building. That's why i have so many questions. 

KvB1
Solution Specialist
Solution Specialist

Yeah the With function is useful because you are basically grabbing a pre-filtered list from SharePoint. The trick is to use as many delegatable filter functions in the first argument of the With function, and then add another filter with non-delegatable filters.

With({_item: Filter(Kvalitet_2021,'Behandlet av'.DisplayName = varUser)},
Filter(_item,

 Here, _item will be a list stored locally, and then you can add your other filter requirements.

 

That the formula Stalin posted didn't work probably something is wrong with the other filters.

 

KvB1_0-1631612863734.png

This will always return false and therefore never return records. 'TextInputSearch.Text in Kunde' will either returns true or false, which isnt a blank value, so it will always return false.

 

The correct way would be to use the same syntax as in the other examples.

 

Also the month thing is confusing, do you always want to filter on a static value called 'Måned', or dyou want to filter the sharepoint column called MånedY by ddMonth.SelectedText.Value?

So how could I write it properly? 

I really dont know what is wrong with the other filters. 2 of them filter by a dropdown selection. Prossess = Choice column with the 7 different values and Maned = a date. I want that the table can be filtered with a chosen month/year value.  The MånedY column in SP is a calculated column, it takes a value fro a column Dato(a date column) and changes the date format in a single line text to a mm-yyyy format.  The Måned value = all dates

And the 3rd filter is a input searchbox which filters by the clients id number. 

KvB1
Solution Specialist
Solution Specialist

Ok, all credit to Stalin, pretty much spot on,

With({_item: Filter(Kvalitet_2021,'Behandlet av'.DisplayName = varUser)},
Filter(_item,
(IsBlank(ddProssess.Selected.Value) || ddProssess.Selected.Value = Prossess.Value)
&& (IsBlank(ddMonth.Selected.Result) || ddMonth.Selected.Result = "Måned" || MånedY = ddMonth.Selected.Result)
&& (IsBlank(TextInputSearch) || TextInputSearch.Text in Kunde)
)
)

The date filter is the most tricky because of the calculated column, you might get a red line under MånedY. Maybe try without it first:

With({_item: Filter(Kvalitet_2021,'Behandlet av'.DisplayName = varUser)},
Filter(_item,
(IsBlank(ddProssess.Selected.Value) || ddProssess.Selected.Value = Prossess.Value)
&& (IsBlank(TextInputSearch) || TextInputSearch.Text in Kunde)
)
)

The formula is correct, no red underlines, but it doesn't return any data

Ekrānuzņēmums 2021-09-14 194207.jpg

 

StalinPonnusamy
Community Champion
Community Champion

Hi @KalvisT 

  • Can you verify varUser getting the correct name? Insert label on the screen to verify you are getting the name that exist in SP
  • I suggest using Email instead of a name
  • Try the below formula (Added empty in case to verify)

 

With({_item: Filter(Kvalitet_2021,'Behandlet av'.Email = varUserEmail)},
Filter(_item,
(IsBlank(ddProssess.Selected.Value) || IsEmpty(ddProssess.Selected) || ddProssess.Selected.Value = Prossess.Value)
&& (IsBlank(ddMonth.Selected.Result) || IsEmpty(ddMonth.Selected) || ddMonth.Selected.Result = "Måned")
&& (IsBlank(TextInputSearch) || TextInputSearch.Text in Kunde)
)
)

 

 

View solution in original post

Again thank you so much for the help! 

Formula works perfectly, all the problem was in my dropdowns anc collection and User().Email works better.

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,370)