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

Notifications

Announcements

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:
I have the same question (0)
  • 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,505 Super User 2025 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard