cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Filter gallery based on user

Hello!

I have a gallery and I want it to be filtered by the user. If the email adress is in the following column: Admins, administrators

I want them to be able to see it all. If their name does not match the emails from the emails in the culumn, I want them to only see the tickets that they have submitted. To see who made the ticket I have created a column with email().FullName, this is stored under: Mancotabel, Verzender

This is the code of the gallery:

 

SortByColumns(
    Search(
        Switch(selectedStatus,
            "All",MancoTabel,
            Filter(MancoTabel, 
                IsBlank(selectedStatus) ||
                Status = selectedStatus
            )
        ), 
        TextSearchBox1.Text, 
        "Ordernummer",
        "Verzender",
        "Deelorder", 
        "Extern", 
        "Product", 
        "Intern", 
        "Deelorder", 
        "Tekeningnummer", 
        "Omschrijving",
        "Status"
    ), 
    "Datum", 
    If(SortDescending1, Ascending, Descending)
)

So basically we need to put a filter over this that checks if their email is in a column and if it is, it would show all the tickets. If it wouldn't be in there I want it to filter on mancotabel, verzender and then on their full name. So they only see the tickets they created theirselves.

 

It would be awesome if someone could make this code for me and send the code 

 
12 REPLIES 12
Anonymous
Not applicable

The original code like this works indeed. It is just showing all the tickets, which is not really what I want. Here is what is inside of MyCol, basically just all of my columns https://gyazo.com/5b6a2fc5fb14e04511174f4151109236 @v-siky-msft 

 

 

SortByColumns(
      Search(
         Switch(
            selectedStatus,
            "All",
            MancoTabel,
            Filter(
               MancoTabel, 
               IsBlank(selectedStatus) ||
               Status = selectedStatus
            )
         ), 
         TekstZoekVeld.Text, 
         "Ordernummer",
         "Verzender",
         "Deelorder", 
         "Extern", 
         "Product", 
         "Intern", 
         "Deelorder", 
         "Tekeningnummer", 
         "Omschrijving",
         "Status"
      ), 
      "Datum", 
      If(
         SortDescending1, 
         Ascending, 
        Descending
      )
   )

 

 

Hi @Anonymous ,

 

It seems the OnStart property is not triggered, please Click 'Run OnStart' to check if the issue is fixed.

Snipaste_2020-03-06_16-21-04.png

And I recommend you rewrite the codes, instead of just replacing MancoTabel by MyCol, to debug which part is wrong.

Sik

Anonymous
Not applicable

That has indeed fixed this. This is what is inside now:

 

I also figured out what went wrong... I forgat to replace the "TextSearchBox1.Text" with the name of mine, because I renamed it. I don't get any errors now. I have tested this and I think this got it working! Thank you

So I need to replace MancoTabel with MyCol everywhere inside of my application? I now get this error trying to submit a ticket: https://gyazo.com/1c32613d02a2fc41d49a7b44d1b2c3a1

https://gyazo.com/4b92b5d49dfdf75416548e22c750c908

It seemed to have worked for a few minutes but now I can see a ticket even when I changed the verzender to 'zien' and not my own name. https://gyazo.com/50f3c554f01f6a8851efe568b977feae

@v-siky-msft 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,538)