Lookup Field with multiple search columns in PowerApps. - CloudFronts

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.

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
                                                                )

SearchFields property:

Set ExistingProduct.SearchFields =  { "ColumnName", "ColumnName"}
For eg: ExistingProductQPEditForm_2.SearchFields = {"cf_productcode", "name"}

Conclusion:

Hope the above Blog helps you to search based on multiple columns for the Lookup field.


Share Story :

Secured By miniOrange