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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (6,017)