cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TimoMigchielsen
Level: Powered On

Get emails from excel database and make a dropdown editable if they match emails with the user

Basically I want to have a table and a column with some emails and I want only a few able to edit a dropdown box.

Currently this is my code that works with the email only: 

If(User().Email = "firstemailfromuser@hotmail.com" || User().Email = "secondemail@hotmail.com", DisplayMode.Edit, DisplayMode.View)

 

How do I get the email address from the table?

3 REPLIES 3

Re: Get emails from excel database and make a dropdown editable if they match emails with the user

Hello @TimoMigchielsen ,

 

Is this in a gallery?

Super User
Super User

Re: Get emails from excel database and make a dropdown editable if they match emails with the user

@TimoMigchielsen 

 

For example, lets say you have an Excel table called "AllowedUsers" with a single column like this:

 

Email
firstemailfromuser@hotmail.com
secondemailfromuser@hotmail.com

 

Put this code in the OnStart property of your app.

Set(isUserAllowed, User().Email in AllowedUsers.Email)

 

Finally, use this code in the DisplayMode property of your dropdown.

If(isUserAllowed=true, DisplayMode.Edit, DisplayMode.View)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

GarethPrisk
Level: Powered On

Re: Get emails from excel database and make a dropdown editable if they match emails with the user

Assuming you have your Excel source, let's assume it's called ExcelFile, and has a Table called Emails.

I would begin by setting a variable with the User's Email (global, or local)

  • Set(gblUserEmail,User().Email)
  • UpdateContext({locUserEmail: User().Email})

Then you can check for that variable in the Table's columns.

If(
    gblUserEmail in ExcelFile.emailColumnName,
    DisplayMode.Edit, // If found
    DisplayMode.View // If not found
)

Given that it's an IF function, this can be used for any behavior (like the DisplayMode in your example, but could also be for show/hide, or any other outcome based on the IF evaluation).

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,380)