cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User III
Super User III

Re: Filter a gallery based on users

Ok @TimoMigchielsen ,

Can you please send a screenshot - with code this big, it is impossible for me to debug it locally. I am trying to give guidance on the structure required and have to rely on you a bit to interpret the intention.

Look at it this way

If(
  Condition (is admin),
  code that works,
  other code that works
)
Highlighted
Post Prodigy
Post Prodigy

Re: Filter a gallery based on users

Highlighted
Super User III
Super User III

Re: Filter a gallery based on users

Ok @TimoMigchielsen There is no error displayed message in this.
Firstly, put a label on the screen and set the Text to gblIsAdmin and see if is true or false.
If so, as I said in my previous post

If(
  gblIsAdmin,
  code that works,
  other code that works
)

There is probably a bracket or commas in the wrong place as I mentioned.
All you have to do if GblAdmin is a Boolean is put the two bits (with and without the user filter) in the first and second conditions.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Highlighted
Post Prodigy
Post Prodigy

Re: Filter a gallery based on users

GblIsAdmin = True

Highlighted
Post Prodigy
Post Prodigy

Re: Filter a gallery based on users

We still need the filter right? I hate nesting these formulas and I can't get it to work myself @WarrenBelz 

Highlighted
Super User III
Super User III

Re: Filter a gallery based on users

Hi @TimoMigchielsen ,

Yes you do need the filter otherwise you cannot set one rule for Admins and another for users.

Have a look at the Collection option I gave - this is much easier to do as you can use the existing code you know works and then simply filter the collection. Note timezone issues will see me offline shortly.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Post Prodigy
Post Prodigy

Re: Filter a gallery based on users

I have been trying many things but I am clueless on how to combine these things...

 

 

 

Highlighted
Super User III
Super User III

Re: Filter a gallery based on users

OK @TimoMigchielsen ,

Your code is very large and unfortunately I have no access to your data set or the correct references to it, so I simply responded to the issue your had, which was the admin access. I have mentioned this in previous posts.

I have now had a look at the code and it certainly has a number of issues in the structure and it is not totally clear to me exactly what you are trying to achieve.

Can you please put in bullet form each step you are trying to do - Sort, Conditions, Fields, If options etc - in other words, what do you want the output to be.

 

 

 

 

Highlighted
Post Prodigy
Post Prodigy

Re: Filter a gallery based on users

Alright! I will try and explain my code to you. @WarrenBelz 

We are basically sorting the gallery with a selectedstatus. My application is a ticket system where people can submit a ticket. Each ticket has its own status. Currently I have 4 different statussus. For this I am using a switch. I then have a searchfield where I can search for all of these things below "TekstZoekVeld.Text". Then I have an icon to sort ascending and descening. I am using this so I can quickly switch between the dates. Quickly change between latest and first tickets. Whenever someone created a ticket, their fullname is stored in a textfield and saved under MancoTabel, Verzender. This is how the information is stored: https://gyazo.com/c4395149a977b657743957ff1a1b9c72 . What am I trying to do is, Filter this whole gallery by the current user of the application. Because I am making the application right now, I am the only one in that list in the database but there will be many more than just me when I bring out the application. So basically whenever the application starts up, I want it to save the fullname of the current user. So basically, if my name would be Shane Young, instead of what my name is right now, I want it to only see the tickets with the full name of the current user. How this makes it more clear. Then I also have a table with administrators email addresses. If the current users email matches one of the email in there, I want it to see all the tickets.

-All
-Open
-In behandeling
-Verwerkt in Ridder


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
      )
   )

 The code below is for the start up off my application.

Set(gblUser, User().Email);
Collect(colAdminList,Admins.Administrators);
Set(
    gblIsAdmin,
    !IsBlankOrError(
        LookUp(
            colAdminList,
            Administrators = gblUser
        )
    )
)



Highlighted
Super User III
Super User III

Re: Filter a gallery based on users

Thanks @TimoMigchielsen ,

I will be back in a PC in a little while. 
I woll try to get this right for you

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,639)