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 / Restrict Gallery based...
Power Apps
Unanswered

Restrict Gallery based on Country

(0) ShareShare
ReportReport
Posted on by 37

Hi guys,

 

I'm trying to restrict infos in gallery based on country column of a sharepoint list:

 

Example of rule:

 

If a user of Argentina needs to filter something in app, he can't see infos of other countries in the app.

 

But if a user of Brazil needs to filter something, he can be able to see all infos of that sharepoint list.

 

So basically Brazil users are admins of the app, because of that them allow to see all informations.

 

In the Sharepoint List i'm using in gallery, i have columns: email, country, etc.

 

Another point is, i already have two filters in this gallery based on a text input field and a combobox.

Categories:
  • JB0007 Profile Picture
    308 on at

    Hi @MarcosP ,

     

    I would have created a collection in the app OnStart property to filter the list based on the country of the user.

    I would have also create another gallery and pass the collection in that gallery.

    In the gallery items property I would insert the 2 filters that you mentioned above to filter the collection.

    In the Visible property of this gallery I would put a if statement for the users who are NOT admin to be true.
    And I would insert an if statement in the gallery where the admin users can see everything to "true" of the country is Brazil.

     

    Regards.

  • MarcosP Profile Picture
    37 on at

    Hello @JB0007, thanks for the reply!

     

    I'm confused about how to do that:

     

    And I would insert an if statement in the gallery where the admin users can see everything to "true" of the country is Brazil.

     

    Country is just one column of the sharepoint list i need to pass in the gallery, if i filter something how to turn this like: Country = Argentina, just show the columns where Country = Argentina.

     

    I have other List in sharepoint called "User" there i have a column called "Function" to see if the user is a admin or not and a column called "Country" too.

     

    Formula i'm using on start of the app:

    Set(varCountry;First(Filter(Table_Users;Title = User().Email)).Country)

     

    The actual formula i'm using in gallery:

    If(
    varCountry = "Argentina";
    Search(
    Filter('mainList';If(!IsBlank(ComboBox1_2.Selected.Result);'10_Manager Name' = ComboBox1_2.Selected.Result;true)
    );
    TextInput1_2.Text;

    "field_5";
    "field_3";
    "field_19"

     

    But with this shows all information of the list, not just the informations about Argentina.

     

     

     

  • BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @MarcosP ,

     

    Adding another condition in your filter function should do the trick:

     

    Filter(
    	'mainList';
    	If(
    		!IsBlank(ComboBox1_2.Selected.Result);
    		'10_Manager Name' = ComboBox1_2.Selected.Result;
    		true
    	) &&
    	If(
    		varCountry="Brazil";
    		true;
    		Country = varCountry
    	)
    		
    );

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard