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

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 II
Dual Super User II

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!

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?

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!

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 🙂

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
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,036)