Lookup Field with multiple search columns in PowerApps.
Introduction:
In this blog, we will learn how to set multiple search fields in a Lookup Field.
Use Case:
We have a requirement where there is a Field (Data Field: Lookup) on the form, which should search records according to multiple columns. The Field on the Form is a Combo Box
Steps:
1. This is the form of Quote Product. We want to allow searching based on multiple column.
![](https://www.cloudfronts.com/wp-content/uploads/2020/04/image-3.png)
2. To allow searching based on multiple fields, click on the Combo Box.
Items property:
Set ExistingProduct.Items = Sort( Filter( Filter( Data Source, Condition ), StartsWith( Text, SearchText ) Or StartsWith( Text, SearchText ) ), ColumnName ) For eg: ExistingProductQPEditForm_2.Items =Sort( Filter( Filter( [@Products], Status = 'Status (Products)'.Active ), StartsWith( 'Product Code', ExistingProductQPEditForm_2.SearchText ) Or StartsWith( Name, ExistingProductQPEditForm_2.SearchText ) ), Name )
![](https://www.cloudfronts.com/wp-content/uploads/2020/04/image-1-1024x376.png)
SearchFields property:
Set ExistingProduct.SearchFields = { "ColumnName", "ColumnName"} For eg: ExistingProductQPEditForm_2.SearchFields = {"cf_productcode", "name"}
![](https://www.cloudfronts.com/wp-content/uploads/2020/04/image-2-1024x239.png)
Conclusion:
Hope the above Blog helps you to search based on multiple columns for the Lookup field.