Hi All,
i am using the below code for filtering my gallery, how do i remove delegation warning in it? The delegation warning comes around the or condition and around the &&. How can i remove the delegation?
If(
Dropdown1.Selected.Result = "All Projects" && Dropdown1_1.Selected.Result = "All Projects" && IsBlank(statusvalue),
SortByColumns(
Filter(
ITprojects,
Or(
(TextInput2.Text in 'Short Title'),
(TextInput2.Text in Title),
(TextInput2.Text in 'IT Lead'.DisplayName)
) && If(
Value(from.SelectedDate) = 0,
true,
'Actual Start Date' >= from.SelectedDate && 'Actual Start Date' <= to.SelectedDate
)
),
"Created",
Descending
)
Solved! Go to Solution.
@Anonymous ,
The Delegation Warning is on the in and Date Filters (none of these are Delegable) - firstly, please have a read of my blog on Delegation and it may explain the issue with a couple of workarounds. If your list will always have less than 2,000 items (and you have your limit set to this) , you can get rid of the warning with this (but it will only work on the first 2,000 items if the list grows bigger).
With(
{
wProjects:ITprojects,
wText:TextInput2.Text
},
If(
Dropdown1.Selected.Result = "All Projects" &&
Dropdown1_1.Selected.Result = "All Projects" &&
IsBlank(statusvalue),
SortByColumns(
Filter(
wProjects,
(
wText in 'Short Title' ||
wText in Title ||
wText in 'IT Lead'.DisplayName
) &&
(
Value(from.SelectedDate) = 0 ||
(
'Actual Start Date' >= from.SelectedDate &&
'Actual Start Date' <= to.SelectedDate
)
)
),
"Created",
Descending
)
)
)
There are some other filters rather than in if you are looking for an exact match - use StartsWith(), but Date queries are not Delegable.
If StartsWith() will work, you can do this
If(
Dropdown1.Selected.Result = "All Projects" &&
Dropdown1_1.Selected.Result = "All Projects" &&
IsBlank(statusvalue),
With(
{
wProjects:
Filter(
ITprojects,
StartsWith('Short Title',TextInput2.Text) ||
StartsWith(Title, TextInput2.Text) ||
StartsWith('IT Lead'.DisplayName, TextInput2.Text)
)
},
SortByColumns(
Filter(
wProjects,
(
Value(from.SelectedDate) = 0 ||
(
'Actual Start Date' >= from.SelectedDate &&
'Actual Start Date' <= to.SelectedDate
)
)
),
"Created",
Descending
)
)
)
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.
@Anonymous ,
The Delegation Warning is on the in and Date Filters (none of these are Delegable) - firstly, please have a read of my blog on Delegation and it may explain the issue with a couple of workarounds. If your list will always have less than 2,000 items (and you have your limit set to this) , you can get rid of the warning with this (but it will only work on the first 2,000 items if the list grows bigger).
With(
{
wProjects:ITprojects,
wText:TextInput2.Text
},
If(
Dropdown1.Selected.Result = "All Projects" &&
Dropdown1_1.Selected.Result = "All Projects" &&
IsBlank(statusvalue),
SortByColumns(
Filter(
wProjects,
(
wText in 'Short Title' ||
wText in Title ||
wText in 'IT Lead'.DisplayName
) &&
(
Value(from.SelectedDate) = 0 ||
(
'Actual Start Date' >= from.SelectedDate &&
'Actual Start Date' <= to.SelectedDate
)
)
),
"Created",
Descending
)
)
)
There are some other filters rather than in if you are looking for an exact match - use StartsWith(), but Date queries are not Delegable.
If StartsWith() will work, you can do this
If(
Dropdown1.Selected.Result = "All Projects" &&
Dropdown1_1.Selected.Result = "All Projects" &&
IsBlank(statusvalue),
With(
{
wProjects:
Filter(
ITprojects,
StartsWith('Short Title',TextInput2.Text) ||
StartsWith(Title, TextInput2.Text) ||
StartsWith('IT Lead'.DisplayName, TextInput2.Text)
)
},
SortByColumns(
Filter(
wProjects,
(
Value(from.SelectedDate) = 0 ||
(
'Actual Start Date' >= from.SelectedDate &&
'Actual Start Date' <= to.SelectedDate
)
)
),
"Created",
Descending
)
)
)
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.
Hi @Anonymous :
Firstly,let me explain why you encountered delegation error.
The point is that "in" is not delegable.I think this link will help you a lot:
Power Apps delegable functions and operations for SharePoint
Secondly,maybe you could try:
If(
Dropdown1.Selected.Result = "All Projects" && Dropdown1_1.Selected.Result = "All Projects" && IsBlank(statusvalue),
SortByColumns(
Filter(
ITprojects,
Or(
(TextInput2.Text = 'Short Title'),
(TextInput2.Text = Title),
(TextInput2.Text = 'IT Lead'.DisplayName)
) && If(
Value(from.SelectedDate) = 0,
true,
'Actual Start Date' >= from.SelectedDate && 'Actual Start Date' <= to.SelectedDate
)
),
"Created",
Descending
)
Best Regards,
Bof