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

If(Lookup..Syntax help!

Hi,

I have a table datasource with 2 columns,users( text) and adminstatus(bool)-true or false.

Table name is users.

i am trying to define if the logged user has the status true or not.

 

If yes, do something.

 

i used this but it s not working, ...

 

If (Lookup(datasource;user().Fullname in datasource.username; admin); ....;.....)

 

ANy help?

 

THANKS A LOT!

 

 

4 ACCEPTED SOLUTIONS

Accepted Solutions
ansrikanth
Resolver III
Resolver III

@Masino 

Try this .. 

If(LookUp(datasource, username=User().FullName, adminstatus)=true, "Admin", "not Admin")

 

Thank you

-Srikanth

View solution in original post

iAm_ManCat
Super User
Super User

Hi @Masino,

 

We should avoid using names when filtering, as its possible that there may be more than one person with the same name, however email addresses can't be duplicates (MS Exchange doesn't allow it).

 

Something like this should work for you:

 

If(
   Lookup(datasource; userEmailColumn = User().Email).adminstatus; 
   DoSomething();
   OtherwiseDoSomethingElse()
)

 

 

Could you try modify that for your needs and let me know how you get on,

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Error solved using iAm_ManCat's formula.
Now, if i use the lookup statement in an empty label it returns true, perfect. But when i use it with IF in the Dysplaymode propriety of the combobox, i can see it in view mode. Suggestions?

View solution in original post

Masino
Super User
Super User

Well..i solved making a new label and hiding it. It will have a value based ont he output of the lookup formula, and  so i just made: 
F.Eks, If( label 5 = true ; Displaymode.edit;Displaymode.view)

 

Thanks!

View solution in original post

6 REPLIES 6
ansrikanth
Resolver III
Resolver III

@Masino 

Try this .. 

If(LookUp(datasource, username=User().FullName, adminstatus)=true, "Admin", "not Admin")

 

Thank you

-Srikanth

iAm_ManCat
Super User
Super User

Hi @Masino,

 

We should avoid using names when filtering, as its possible that there may be more than one person with the same name, however email addresses can't be duplicates (MS Exchange doesn't allow it).

 

Something like this should work for you:

 

If(
   Lookup(datasource; userEmailColumn = User().Email).adminstatus; 
   DoSomething();
   OtherwiseDoSomethingElse()
)

 

 

Could you try modify that for your needs and let me know how you get on,

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


I got no errors this time, but i set my data as admin,and it doesnt work..

If(
LookUp(
Medarbejderne;
Navn_excel = User().FullName;
Admin) = true;
DisplayMode.Edit;
DisplayMode.View)

 

P.s. I am the only one with this name 😃

 

I am actually try to make a combox selectable for some users and others has to see only the default value.

It says that i cannot compare text and boolean values..actually it s true ^^!

ansrikanth
Resolver III
Resolver III

@Masino ensure you have the same full name. You are saying there is a warning in comparision? can you share a screenshot of where the warning is? is your "Admin" field a boolean?

 

Than you

-Srikanth

Error solved using iAm_ManCat's formula.
Now, if i use the lookup statement in an empty label it returns true, perfect. But when i use it with IF in the Dysplaymode propriety of the combobox, i can see it in view mode. Suggestions?

Masino
Super User
Super User

Well..i solved making a new label and hiding it. It will have a value based ont he output of the lookup formula, and  so i just made: 
F.Eks, If( label 5 = true ; Displaymode.edit;Displaymode.view)

 

Thanks!

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