Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Filter in a ListBox

(0) ShareShare
ReportReport
Posted on by 11

Dear PowerApps Community,
I'm pretty new to powerApps and I'm stuck with the following case: I want to filter the entries in a ListBox depending on a previous selection in another field. I structured the Items property of the ListBox as follows:

Filter(Choices([@Maintenance_Reports].Activities), [@Maintenance_Activities].Title = DataCardValue8.Selected.Value)

The error is: Some types are incompatible for comparison. These types cannot be compared: Table, Text.
Can I somehow match the types in the property?
I'm grateful for any help.

  • Ami K Profile Picture
    Ami K 15,655 on at
    Re: Filter in a ListBox

    @XenYx - this is not a misunderstanding. You were given a satisfactory answer to your question, and now you are asking a brand new and completely different question. This question should have been raised as a separate post. 

     

    Suppose someone in the Community wants to know how to submit an Edit Form control with a List Box control embedded inside it. How are they going to find the solution if the title of this post is "Filter in a ListBox?"

     

    Please be mindful of this in future and please accept the solution to your question.

     

    Regarding the new question, what is the data type of the field you want to update in the "Maintenance_Reports" list?

  • XenYx Profile Picture
    XenYx 11 on at
    Re: Filter in a ListBox

    @Amik 
    Sorry for the misunderstanding. Yes, the ListBox/ComboBox is on an EditForm or I would like to use it to create a new entry.

     

  • Ami K Profile Picture
    Ami K 15,655 on at
    Re: Filter in a ListBox

    @XenYx - you seem to be asking a different question. A List Box control and an Edit Form control are totally separate controls.

  • XenYx Profile Picture
    XenYx 11 on at
    Re: Filter in a ListBox

    @Amik 
    Thanks, the filtering in the form works perfectly. However, the selected values are then not saved in the Maintenance_Reports list. The update value in the DataCard is: ListBox1.SelectedItems.

     

  • Verified answer
    Ami K Profile Picture
    Ami K 15,655 on at
    Re: Filter in a ListBox

    @XenYx - it's possible I am over-simplifying things here, but is this all you're trying to do?

     

    Filter(
     Maintenance_Activities,
     Len(DataCardValue8.Selected.Value) = 0 || Title = DataCardValue8.Selected.Value
    )
  • XenYx Profile Picture
    XenYx 11 on at
    Re: Filter in a ListBox

    @Amik 

    The ComboBox "Machine" in Maintenance_Reports is a single-select-choice.

  • Ami K Profile Picture
    Ami K 15,655 on at
    Re: Filter in a ListBox

    @XenYx - is the ComboBox control also set to allow multiple selections?

  • XenYx Profile Picture
    XenYx 11 on at
    Re: Filter in a ListBox

    @Amik 

    Yes, my data source is Sharepoint. The ListBox Activities in Maintenance_Reports table is is a multi-select Choice and LookUp data type on a field Activity in the Maintenance_Activities table. The field Activity in the table Maintenance_Activities is a normal Text field.
    The Maintanance_Activities list is structured as follows:

    TitleActivity
    Machine1Activity1
    Machine1Activity2
    Machine2Activity1
    Machine2Activity2


    If I now select a machine in Maintenance_Reports, I only want to see the entries from Maintenance_Activities that are assigned to this machine.

  • Ami K Profile Picture
    Ami K 15,655 on at
    Re: Filter in a ListBox

    @XenYx -

     

    1. Assuming your data source is SharePoint, is the "Activities" field in the "Maintenance_Reports" table a LookUp data type to a field called "Title" in the Maintenance Activities table?
    2. Is Activities field a single-select Choice?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,636

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,942

Leaderboard