- I have a table Table1 with the key column CP.
- I have another table Table2 with the key column ID and two more columns, CP and Code.
- I have a main gallery in the app with the data source from Table1 table.
I need to filter the gallery with these conditions:
- user input sInput string is part of the Code field of the Table2 table (this filter will output a list of rows from which I need only the CP values):
- filter the records of Table1 based on the records found in the condition above, matching the CP of the rows found with the CP field of the Table1 table.
I tried with this code in the OnChange event of the text bar:
ClearCollect(
FilterRange;
Distinct(
Filter(
'Table2';
sInput in Code
);
CP
)
);;
And then setting the Items of the gallery this way:
Filter(
Table1;
CP in FilterRange
);
The main issue with this code is that I lose the delegation (even though Power Apps isn't warning me), since the ClearCollect function is not delegable. This is really bad, since I can only find the first n records of Table2, where n is the delegation limit (and I have more than 2000 records which is the maximum delegation limit allowed by Power Apps).
Is there a way to achieve the same result and maintain the delegation at the same time?
Thank you in advance.