Search code examples
powerappspowerapps-canvas

Similar conditions on a filtered table have different implications for delegations on Power Apps


New to Power Apps and delegations are driving me crazy.

On a canvas app, I have the following code which works fine:

ClearCollect(
    colFilteredByWHandProd,
    Filter(
        tracker_data,
        inv_dt <= CountDate.SelectedDate && wh_code = varSelWH && item_no = varSelProd
        )
);

However, if I try to add a fourth filter, which evaluates on a column on the list that is either "0" or "1", I get possible delegation error warnings:

ClearCollect(
    colFilteredByWHandProd,
    Filter(
        tracker_data,
        proj_val <> "1" && inv_dt <= CountDate.SelectedDate && wh_code = varSelWH && item_no = varSelProd
        )
);

This doesn't make any sense. Both the wh_code = varSelWH and the item_no = varSelProd portions donot throw any error warnings. Furthermore, the item_no, wh_code and proj_val fields on the SP list are single line text fields.

I have tried changing the order and even reducing the number of filters. But consistently, I only get the error warning on proj_val <> "1"

One possible culprit is that the proj_val field on the SP list is a calculated column.


Solution

  • Instead of chaining filter conditions, you should nest multiple Filter() functions to overcome delegation.

    A 'not' operation is not delegable to SharePoint, so implement a logic where it is not the innermost filter.