nmHao79
nmHao79

Reputation: 1

Filter People in ComboBox Based on Items in Gallery in Power Apps

I am building a Power Apps screen with the following setup:

  1. A ComboBox (cmb) to display people from the User field in the SharePoint list Tasks.
  2. A Gallery (Final) connected to the Tasks list, showing 3 items, each representing a different User.

Objective: I want to filter the ComboBox (cmb) to display only the people currently shown in the Final gallery, rather than all the people associated with my account.

Implementation Details:

OnVisible of the Screen:

ClearCollect(
    UserCollection,
    ForAll(
        Tasks,
        If(
            !IsBlank(User),
            User
        )
    )
)

Items of the ComboBox:

Filter(
    Choices([@Tasks].'User'),
    DisplayName in ForAll(
        UserCollection,
        ThisRecord.DisplayName
    )
)

Issues Encountered:

  1. ForAll: The function 'ForAll' has some invalid arguments.
  2. DisplayName: Name isn't valid. 'DisplayName' isn't recognized.
  3. UserCollection: Incompatible type. We can't evaluate your formula because of a type error.

Expected Behavior: The ComboBox should show only the people currently appearing in the Gallery (Final).

Actual Behavior: The ComboBox filters all people connected with my account, not just the ones visible in the Gallery.

Question: How can I correctly filter the ComboBox (cmb) to show only the User values currently displayed in the Gallery?

Upvotes: 0

Views: 54

Answers (1)

Farkas János
Farkas János

Reputation: 196

The items parameter of your Gallery should the original datasource, not a Choice() function, and you should filter it. Like:

Filter(
Tasks,
User.Email = ComboBox1.Selected.User.Email)

Upvotes: 0

Related Questions