Running into some strange behavior when using the First or FirstN functions in PowerApps.
I have a data table control in the PowerApp that shows a filtered and sorted data source (SharePoint list). The filtering is based on a variable (we'll call it var_Item_Num) that the user enters. The formula looks like this:
This is fine if var_Item_Num is found -- the most recent result is returned. However the behavior changes when var_Item_Num is not found; instead of showing blank, the data table just doesn't update. It shows whatever the previous result was. For example if I search 1111 and view the first result, then search 2222 which is not in the data source, the result for 1111 is still shown.
If I remove First, this behavior is corrected immediately -- a search for 1111 and then 2222 will yield an empty data table as expected.
For kicks I also tried using a collection as a data source instead of the sharepoint list, but had the same result.
Thanks for the reply @v-monli-msft -- tried this formula, exact same results unfortunately!
The function works correctly when I use a valid item number -- data table shows the first result for that item number.
When the item number is not found, this function does not update and the data table continues to show whatever the previous result was. Data table only updates once a valid item number is entered.
To be clear I am finding this issue to be associated with the First/FirstN functions (last/LastN as well actually). If I use the exact same filter without First, everything works correctly -- if an invalid item # is entered, the data table becomes empty, as expected.