web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Use Set Function to As...
Power Apps
Answered

Use Set Function to Assign Multiple Values to One Variable

(1) ShareShare
ReportReport
Posted on by

Hello!

 

I have a function in my app that filters a gallery based on a text value of an item and the user's email. I was wondering if it is possible to assign multiple values to one variable for each email. For example, if my email is person1@gmail.com, can I make it so that my gallery displays values where the gbl_filter_value is both "Pending L1 Approval" and say, "Submitted"? 

 

Switch(
    User().Email,
    "person1@gmail.com",
    Set(
        gbl_filter_value,
        "Pending L1 Approval"
    ),
    "person2@gmail.com",
    Set(
        gbl_filter_value,
        "Pending L2 Approval"
    ),
    "person3@gmail.com",
    Set(
        gbl_filter_value,
        "Pending L3 Approval"
    )
)
 
 
 
Items property for said gallery:
SortByColumns(
    Filter(
        'Dashboard',
        'Approval Status'.Value = gbl_filter_value,
        StartsWith(
            Title,
            TextSearchBox1_1.Text
        ) || StartsWith(
            'Date Submitted',
            TextSearchBox1_1.Text
        ) || StartsWith(
            'Version #',
            TextSearchBox1_1.Text
        ) || StartsWith(
            'AFE Number',
            TextSearchBox1_1.Text
        )
    ),
    "Title",
    If(
        SortDescending1,
        SortOrder.Descending,
        SortOrder.Ascending
    )
)
Categories:
I have the same question (0)
  • ivan_apps Profile Picture
    2,189 Moderator on at

    You could change your variable to be an Table variable and add multiple items to the array depending on the email. That way your can iterate through it or use the "in" operator to filter your gallery on multiple items.

     

    Set(gbl_filter_value, Table("Pending L1 Approval" , "Submitted"))

     

    your filter criteria can then be something like:

    'Approval Status'.Value in gbl_filter_value

  • Verified answer
    Sam_Fawzi Profile Picture
    991 Super User 2026 Season 1 on at

    Hey @hhuynhfm ,

    Yes, it is possible to filter a gallery based on multiple values for a single user. Instead of setting gbl_filter_value to a single value, you can create a collection of values. Then, you can filter the gallery to display items that match any of the values in this collection. Here's how you can do it:

     

    Update the Switch Statement:

     

    Switch(
     User().Email,
     "person1@gmail.com",
     ClearCollect(
     gbl_filter_values,
     "Pending L1 Approval",
     "Submitted"
     ),
     "person2@gmail.com",
     ClearCollect(
     gbl_filter_values,
     "Pending L2 Approval"
     ),
     "person3@gmail.com",
     ClearCollect(
     gbl_filter_values,
     "Pending L3 Approval"
     )
    )

     

     

     

    Updated Gallery Items Property:

     

    SortByColumns(
     Filter(
     'Dashboard',
     'Approval Status'.Value in gbl_filter_values &&
     (
     StartsWith(Title, TextSearchBox1_1.Text) ||
     StartsWith('Date Submitted', TextSearchBox1_1.Text) ||
     StartsWith('Version #', TextSearchBox1_1.Text) ||
     StartsWith('AFE Number', TextSearchBox1_1.Text)
     )
     ),
     "Title",
     If(SortDescending1, SortOrder.Descending, SortOrder.Ascending)
    )

     

     

     

    Hope this will help!

    Cheers

  • hhuynhfm Profile Picture
    on at

    Hello @samfawzi_acml

     

    Thanks for your reply! The first function is working but when I try the Items property for my gallery, it gives me the error "Incompatible types for comparison. These types can't be compared: Text, Table". How can I fix this?

  • Verified answer
    Sam_Fawzi Profile Picture
    991 Super User 2026 Season 1 on at

    Sorry, here is the updated Gallery Item property:

    SortByColumns(
     Filter(
     'Dashboard',
     'Approval Status'.Value in gbl_filter_values.Value && // Correct the comparison here
     (
     StartsWith(Title, TextSearchBox1_1.Text) ||
     StartsWith('Date Submitted', TextSearchBox1_1.Text) ||
     StartsWith('Version #', TextSearchBox1_1.Text) ||
     StartsWith('AFE Number', TextSearchBox1_1.Text)
     )
     ),
     "Title",
     If(SortDescending1, SortOrder.Descending, SortOrder.Ascending)
    )

     

    Give it a try and let me know!

  • hhuynhfm Profile Picture
    on at

    Thank you so much!! This worked 😊

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard