cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cknight
Level: Power Up

Nested lookup returning a boolean.

I'm trying to use a nested lookup to match a user within an organization with their ID within our system.
 

LookUp('[dbo].[Users]',UserID = LookUp('[dbo].[OrganizationUser]', ThisItem.OrganizationUserID = OrganizationUserID, UserID),FirstName)

 

It returns a boolean value of false instead of a string. I've seen the question asked before here, but my code matched the solution, and it still didn't work.

 

 

5 REPLIES 5
Microsoft Employee

Re: Nested lookup returning a boolean.

Hello @Cknight,

That formula does not seem to be correct. Please try to update it as following:

LookUp('[dbo].[Users]',UserID = LookUp('[dbo].[OrganizationUser]', ThisItem.OrganizationUserID = OrganizationUserID).UserID).FirstName

Cknight
Level: Power Up

Re: Nested lookup returning a boolean.

Rather than displaying as a boolean, it's now just showing a blank string

Microsoft Employee

Re: Nested lookup returning a boolean.

Are you sure the OrganizationUserID  exists in '[dbo].[OrganizationUser]?

You can also validate that formula with a test:

Button1.OnSelect = ClearCollect(c1, {name1:"one", id:1},{name1:"two", id:2},{name1:"three", id:3},{name1:"four", id:4});ClearCollect(c2, {name2:"five", id:1},{name2:"six", id:2},{name2:"seven", id:3},{name2:"eight", id:4})

Label1.Text=LookUp(c1, id=LookUp(c2, id=2).id).name1

The label control should properly display the "name1" value from c1

Cknight
Level: Power Up

Re: Nested lookup returning a boolean.

A similar query works in SQL management studio, and it shows that both columns exist. The documentation for the lookup function looks different from the one you're showing, and the other format has worked in every other place in the app. 
LookUp( IceCream, Flavor = "Chocolate", Quantity )  

Microsoft Employee

Re: Nested lookup returning a boolean.

LookUp( IceCream, Flavor = "Chocolate", Quantity )  

is similar to

LookUp( IceCream, Flavor = "Chocolate").Quantity 

so both are correct.

In your original formula however, the first pattern did not work for me (probably because similar column names in both collections).

In order to debug the issue in your case, I would suggest to check the values and to ensure they're indeed correct. Also, would be good to ensure the letter casing matches and that there're no extra spaces.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 211 members 4,528 guests
Please welcome our newest community members: