Search code examples
powerappspowerapps-canvaspowerapps-formula

How to filter items using an input field and a dropdown in PowerApps?


I have connected my Excel table to a gallery control in PowerApps. I have a dropdown box to select values for the 'Manager' column and an input field to type in the name of the employee. I tried doing-

Filter(Table1,StartsWith(Name,empSearchbox.Text) && (Manager = dropdownManager.Selected.Value ||dropdownManager.Selected.Value=Blank()))

This gives me errors-

    Issue 
        Incompatible types for comparison. These types can't be compared: Text, Error.
        We can't evaluate your formula because the values being compared in the formula aren't the same type. 

Second error:

        Name isn't valid. This identifier isn't recognized. 
        This error appears most commonly when a formula refers to something that no longer exists (for example, a control that you've deleted). 
        Location No

The first part in the Filter function works alone. Edit: The = and .Value are underlined in red.


Solution

  • Assuming your dropdownManager field has a blank value as initial/unselected value, try:

    Filter(
      Table1,
      StartsWith(
        Name,
        empSearchbox.Text
      ) && ( Manager = dropdownManager.Selected.Result || isBlank( dropdownManager.Selected.Result)
      )
    )
    

    This will get you started ;-)