Hide Power Apps Combo Box Choice Value Based On Text Input

While working on a client project using Power Apps, I was required to hide choice values in a combo box, which I provided in the text input field. I also needed to check if the first five characters from the text input were present on the combo box choices that needed to be hidden.

I achieved this with the Power Apps Filter function. In this article, we will discuss how to hide Power Apps combo box choice value based on text input control.

Hide Power Apps Combo Box Choice Value Based on Text Input

I created a Power Apps Asset Request Form where employees can request the assets through this form. I’m using a SharePoint list containing the following fields to store these details.

filter power apps lookup choice value provided in text input control
Column NameData Type
Employee NameTitle
EmailSingle line of text
Employee IDSingle line of text
DepartmentChoice (IT, HR, SALES, MARKETING)
IssueChoice(New asset request,
Replacement for broken/ faulty device,
Replacement for lost device,
Other reason)
New AssetSingle line of text
State the reason for your asset requestMulti line text
Exchange AssetLookUp [Contains all assets’ names from another list.]

Now, the requirement is that when the user selects the Issue as a “New asset request” value, the New Asset field value and Exchange Asset field value should not be the same.

So, I have to hide the asset name in the “Exchange Asset” lookup choice field that I provided in the “New Asset” field in the Power Apps form so that employees won’t select the same asset in both fields.

In the example below, you can see that whatever the asset name I provided in the “New Asset” field is not present in the “Exchange Asset” field.

hide power apps lookup choice value provided in text input control

Follow the steps below to achieve this!

1. Connect the SharePoint list to the Power Apps application. Then, add a form control and provide the added list name on its DataSource property.

'Asset Request Form'
hide power apps choice value provided in text input control

2. Provide the code below in the items property of the “Exchange Assets” field in the form.

If(
    DCV_Issue.Selected.Value = "New asset request",
    Filter(
        Choices([@'Asset Request Form'].'Exchange Assets'),
        Trim(Text(Value)) <> Trim(Text(DCV_NewAsset.Text))
    ),
    Choices([@'Asset Request Form'].'Exchange Assets')
)

Here,

  • DCV_Issue = Issue datacard value name.
  • Choices([@’Asset Request Form’].’Exchange Assets’) = Retrives the Look up field values.
  • The if condition checks if the issue value is “New asset request.” Then, we need to filter the Exchange Assets field values.
  • Trim() removes unnecessary spaces if the text input or choice value contains.
  • Filter() displays only the Exchange Assets choice values not provided in the New Asset Datacard.
power apps hide choice option based on text input value

Save the changes and preview the app once. While testing, you can see if you chose issue value as “New asset request,” then whatever the asset name entered in the “New Asset” field won’t be present in the “Exchange Asset” field.

filter power apps choice option based on text input value

Hide Power Apps Combo Box Value When It Matches With Text Box Value

In this example, there is one more requirement: We need to check the first six characters from the text input control to ensure they match the combo box choice options. If a match is found, we need to hide that option.

hide power apps combo box choice value matches with the text box input

Follow the steps below to achieve this!

1. In the App Onstart property, I created a collection that stores project IDs.

ClearCollect(colProjectIDS,{ProjectID:"EPS-00"},{ProjectID:"EPS-01"},{ProjectID:"EPS-02"},{ProjectID:"EPS-03"},{ProjectID:"EPS-04"},{ProjectID:"EPS-05"},{ProjectID:"EPS-06"})
how to filter power apps combobox values based on text input value

2. Add a text input control and a combo box control and then provide the code below on the items property of the combo box.

Filter(Distinct(colProjectIDS,ProjectID),Text(Left(Value,6)) <> Text(Left(Txt_ProjectTitle.Text,6)))
filter power apps choice value if matches  with in text input

Now, save the changes and run the app. The text provided in the text input control will appear. If the first six characters match any of the option present combo values, it will hide.

I hope you understand how to hide a combo box choice value if it matches the input provided in the text input control. I have explained two scenarios for hiding combo box choice values in this article. Follow this article if you are also trying to achieve the same functionality.

Also, you may like:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App