cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Wisper
Helper I
Helper I

Evaluate a collection using an if statement

So I have a collection called AdminList, which is collected on startup of App, and it has several columns in it. The column I want is labeled Mail. On a users screen I have a block that says Admin and I want it to return weather they are or not using there Office365Users Mail. Below is what I came up with but it doesn't work. My problem lies in the AdminList part, as I know the Office365Users portion works elsewhere.

 

If(AdminList.value(Mail) = Office365Users.UserProfile(InfoAbout.Text).Mail,"Yes","No")

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Drrickryp 

 

I figured it out. I had to reference a textbox to get it to work correctly. The one that is referenced is pulling the original 

Office365Users.UserProfile(InfoAbout.Text).Mail

string in. Here is what I did.

If(!IsBlank(LookUp(AdminList,mail=TextBox4_97.Text)),"Yes","No")

View solution in original post

6 REPLIES 6
Drrickryp
Super User
Super User

Hi @Wisper 

To see if a user is a member of a list, capture the user's Email in a variable when the App opens.  In the OnStart property of the app put Set(userEmail,User().Email).  You can test this variable against a list membership as follows.

 

!IsBlank(Lookup(Adminlist,email=userEmail))

 

If this formula is put into a Label control, this will return a true or false value. 

 

@Drrickryp 

Thank you for the reply. I am not trying to evaluate the user using the app but on a customer screen. I am trying to see if a specific customer is an Admin.

Wisper
Helper I
Helper I

@Drrickryp , I did try the following but I know he is not an admin and it evaluates as true for some reason.

 

If(!IsBlank(LookUp(AdminList,Mail=Office365Users.UserProfile(InfoAbout.Text).Mail))=true,"Yes","No")

 

 

Sometimes differences in case or spaces can cause the equation to be incorrect.  Try

!IsBlank(LookUp(AdminList,Trim(Lower(Mail))=Trim(Lower(Office365Users.UserProfile(InfoAbout.Text).Mail))))

 in a text box and see what the result is.  You may need to look at the Office users table as well to see if the mail addresses match.

 

@Drrickryp no that didn't work either

@Drrickryp 

 

I figured it out. I had to reference a textbox to get it to work correctly. The one that is referenced is pulling the original 

Office365Users.UserProfile(InfoAbout.Text).Mail

string in. Here is what I did.

If(!IsBlank(LookUp(AdminList,mail=TextBox4_97.Text)),"Yes","No")

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,618)