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 / Filter Gallery View ba...
Power Apps
Unanswered

Filter Gallery View based on User's Unit.

(1) ShareShare
ReportReport
Posted on by

Hi Team,

 

Would like to seek assistance on how can I filter my gallery view based on User's Handling Unit.

Sharepoint list of Users are different from the SP Lists on Gallery.

 

I did some workarounds below. Kindly see codes. But unfortunately, the value returns as Blank.

 

nmlsanmiguel_0-1685505866888.png

 

 

Gallery code:

With(
{

wData:
Filter('Luzon NAFS Dacion',STATUS.Value = ComboBox1.Selected.Value || ComboBox1.Selected.Value = Blank() || UNITS.Value = vHandlingUnit)},

Sort(
Filter(
wData,
FilterByNameDacion.Text in Title ||
FilterByNameDacion.Text in STATUS.Value ||
FilterByNameDacion.Text in 'ACCOUNT NAME'||
FilterByNameDacion.Text in LAN ||
FilterByNameDacion.Text in 'REPO DATE' ||
FilterByNameDacion.Text in 'PMS Booking Date'||
FilterByNameDacion.Text in YEAR ||
FilterByNameDacion.Text in Month),'REPO DATE',SortOrder.Descending))

 

On Start Codes:

Set(vUserName,User().FullName);
ClearCollect(vAssignees,'Luzon NAFS Users');
Set(vHandlingUnit,LookUp(vAssignees, 'User Name'.DisplayName = vUserName,'Handling Unit'.Value));

 

Hoping for some assistance.

 

Thank you and Stay Safe always! 🙂

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @nmlsanmiguel 

    It seems like you're having issues with filtering your Power Apps Gallery based on the user's handling unit.

    From your explanation, I suppose that you might be trying to:

     

    A. Fetch a user's handling unit from a SharePoint List named "Luzon NAFS Users".
    B. Use this handling unit to filter another SharePoint List, "Luzon NAFS Dacion", which populates a Gallery in your Power App Canvas App.

     

    Check if the following is correct:


    On Start Formulas:
    Your OnStart forula seems fine assuming that the 'User Name' field in your SharePoint List ("Luzon NAFS Users") is of type 'Person or Group'.
    If that's the case, the 'Display Name' should match User().FullName.


    Also, confirm that the 'Handling Unit' field in the "Luzon NAFS Users" list is a simple Text or Choice field.

    Please add a Label control to your app and set its Text property to vHandlingUnit to verify that the correct value is being fetched.

     

    2. Gallery Formula:
    If vHandlingUnit is working correctly, but your Gallery is still not showing the correct data, it could be an issue with your filter condition in the wData variable.

     

    It's currently checking if UNITS.Value = vHandlingUnit, which implies that the 'UNITS' field in the "Luzon NAFS Dacion" list is also a Text or Choice field that directly corresponds to the 'Handling Unit' field in the "Luzon NAFS Users" list. Double-check to make sure this is actually correct.

     

    Modify your wData variable as follows to test:

     

    Filter('Luzon NAFS Dacion', (STATUS.Value = ComboBox1.Selected.Value || IsBlank(ComboBox1.Selected.Value)) && UNITS.Value = vHandlingUnit)

     


    This modification checks if both the 'STATUS' is either selected or blank and 'UNITS' equals vHandlingUnit.

    You can try and see if these suggestions help @nmlsanmiguel  and let me know how it goes.

  • nmlsanmiguel Profile Picture
    on at

    Hello, Thank you for your reply. But I tried the text label control vHandlingUnit returned as blank.

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @nmlsanmiguel 

     

    If vHandlingUnit is returning blank, there might be a few different issues:

     

    1. Mismatched User Name: Ensure the user's full name matches exactly between Power Apps (User().FullName) and your SharePoint List ("Luzon NAFS Users"). This includes any spaces, punctuation, or case sensitivity. You could add a text label in your app with User().FullName to verify what Power Apps is recognizing as the current user's full name.

     

    2. Incorrect Field Names or Types: Verify that 'User Name' and 'Handling Unit' are the correct internal names of the SharePoint List columns. SharePoint sometimes changes spaces to x0020 for internal names, which could cause the issue. Also, check if 'Handling Unit' is a text field and 'User Name' is a Person or Group field.

     

    For more details how to check this internal field name, follow the steps below

     

    You can follow the steps below to find the internal field (column) name in SharePoint:

     

    a. Navigate to your SharePoint list.

    b. Click on the gear icon in the top-right corner to open the settings menu and select "List settings."

       If you don't see the "List settings" option, you may not have the necessary permissions. In this case, you'll need to contact your SharePoint admin for assistance.

    c. In the "Columns" section, you'll see a list of all the columns in your list. Click on the name of the column for which you want to find the internal name.

    d. Look at the URL in your browser's address bar. The internal name of the column is the text after the Field= at the end of the URL.

     

    For example, if your URL ends with Field=User%20Name, the internal name of the field is User Name.

    Remember, SharePoint replaces spaces with %20 in the URL, so you'll need to replace %20 with a space when using the internal name in Power Apps. If the internal name of your column doesn't match what you're using in Power Apps, you should update your Power Apps code to use the correct internal name.

    This should help you verify whether you're using the correct field names in your Power Apps code.

     

    NOTE:

    SharePoint uses a specific encoding scheme for special characters and spaces when creating internal field names.

    For instance, when a column is created with a space in its name (e.g., "User Name"), SharePoint replaces the space with the hexadecimal representation of the ASCII value for a space, which is "20", but it prefixes it with "x" and postfixes with "". So a space becomes "x0020" in the internal field name.

    This means the internal field name for "User Name" would be "User_x0020_Name".

    And it would be User_x0020_Name that you need to use in your Power Apps Canvas App in that case.

     

    However, the method I just described for finding the internal field name through the field settings URL decodes this special character representation back into its regular form (a space in this case).

    So, even though SharePoint stores the internal name as "User_x0020_Name", you will see "User%20Name" in the URL because "%20" is the URL-encoded form of a space.

     

    You need to be aware of this when using field names in Power Apps or any other platform that interacts with SharePoint. If a field name includes a space, and you are constructing a string to use as a field reference in PowerApps, you will need to use "x0020" to represent that space.

    Therefore, in PowerApps, you should be using 'User_x0020_Name' if the field name in SharePoint is 'User Name'.

     

     

    3. No Data or Access Issues: Confirm that the "Luzon NAFS Users" list has data and that the logged-in user has sufficient permissions to read data from this list. The user must have at least Read access to this SharePoint list.

    You can also adjust your OnStart formula to try to debug the issue:

    Set(vUserName,User().FullName);
    ClearCollect(vAssignees,'Luzon NAFS Users');
    Set(vHandlingUnitLookup, LookUp(vAssignees, 'User Name'.DisplayName = vUserName));
    Set(vHandlingUnit, vHandlingUnitLookup.'Handling Unit'.Value);

    Here, vHandlingUnitLookup should contain the entire record for the logged-in user from "Luzon NAFS Users" list. You can add a text label in your app with vHandlingUnitLookup to verify if the lookup is successful and the record content. If this lookup is unsuccessful (i.e., returns blank), then the issue is likely with the 'User Name' matching. If the lookup is successful but vHandlingUnit is still blank, then the issue is likely with accessing the 'Handling Unit' field value.

     

    Hope this helps @nmlsanmiguel !

  • nmlsanmiguel Profile Picture
    on at

    My Handling Unit column is a choice column. is he the problem? Per checking all the names and functions are correct. but still returned as blank.

     

    Thank you.

  • nmlsanmiguel Profile Picture
    on at

    Thanks for the Help! But I found the solution not by using the name but email.

     

    Thank you! 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 430

#2
timl Profile Picture

timl 318 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard