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

Lookup Value from a lookup field

Hello

 

I have created Canvas App with a form, where I can select a product from a combo box. This combo box retrieves its values from an entity called "Products". The entity "Products" has a lookup field "Company" which retrieves its values from the entity "Companies".

 

Now, I'd like to show the related "Company" once I've selected a product in a simple text field.

 

I've tried the following formula:

LookUp('Products',cr061_productid = cmbProduct.Selected.Product).Company.Name

The lookup function is correct. If a choose a different field than "Company" from the "Product" entity I get results. 

I assume it's somehow to much for PowerApps or CDS to query directly for the Company.name.

 

Anyone an idea how to resolve this?

5 REPLIES 5
Dual Super User
Dual Super User

Re: Lookup Value from a lookup field

Hi @MarcoLotscherNC 

 

Instead of doing a lookup here, you can directly use the below expression on the "Text" property as:
cmbProduct.Selected.Company.Name
 
If this doesn't help, I will ask you to create a column in the Gallery Items to store the Company name as:
 
AddColumns(Products, "CompanyName", Company.Name)
using this, you can access the name as:cmbProduct.Selected.CompanyName
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
MarcoLotscherNC
Level: Powered On

Re: Lookup Value from a lookup field

Thank you for your tips.

 

Thought, directly accessing the field would be the solution.

 

It would be pretty straight forward.

 

Since I'm not using a gallery (the selected product is part of a combo box in a form) I tried this:

dcvProduct.Selected.Company.Name

But now I get the following error message "Multiple levels of many-to-one relationship expansion aren't supported."

 

Regarding your second hint, I was wondering if I could also add a column to the record of the combo box? Or should I better try storing everything in a collection?

Dual Super User
Dual Super User

Re: Lookup Value from a lookup field

Hi @MarcoLotscherNC 

 

If you have a combobox control, then I would recommend you to add a column in the Items property of the combobox control as:
AddColumns(Products, "CompanyName", Company.Name)
 
This would allow you to access the value as:
dcvProduct.Selected.CompanyName
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
MarcoLotscherNC
Level: Powered On

Re: Lookup Value from a lookup field

I just tried adding this to the "Items" property:

Choices(Products.Name);
AddColumns(Companies,"Company",Company.Name)

This gives me an error like "Expected operator. ...". I suppose I can't combine like I did 🙂

Dual Super User
Dual Super User

Re: Lookup Value from a lookup field

Hi @MarcoLotscherNC 

 

 
Combining two different expressions in Items property is not valid. 
You can update your expression as:
AddColumns(Products,"Company",Company.Name)
 
You can select DisplayFields and Search Fields as Name to get the choices of Name to be displayed in the combobox.
 
In a case, you just want to get the Name and Company Name columns, then you will need to update the formula as:
ShowColumns(AddColumns(Products,"Company",Company.Name),Name,CompanyName)
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,007)