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

Power Apps in Teams: Lookup Values in a Form V2

I previously had a question on Lookups in Forms  that @RandyHayes  helped me with, but this one is more complex (or at least I am making it so in my head!)

 

I'm building a Power App in Teams, with Dataverse for Teams as my datasource.  I'm struggling to get some of my fields to prepopulate properly in edit forms

 

I have a "Requests" table which has a lookup column, Request Type

 

fig 2.png

 

In the Request Types table, I have the "Identifier" which is the lookup column, and 3 additional columns: Category, Type and Sub-type

fig 1.png

 

In my form I have 3 custom fields with cascading Combo Boxes for "Category", "Type" and "Sub-type".  My "Request Types" field will be a hidden field that populates based on the selections in Category, Type and Sub-type.

 

My problem: When I view an existing record, the comoboxes correctly show the correct Category, Type and Sub-type as expected (although strangely they are faded as if they are disabled fields… that's future Sandie's problem) however, when I go into Edit mode the fields are blank.

 

View Mode:

fig 3.png

 

Edit Mode:

fig 4.png

 

When I select the correct Category (in this case Website), the Type, Sub-type and Request Type suddenly fill to the correct selections as well.

fig 5.png

 

I understand that the Type, Sub-Type and Request Type are not initially populated because they are dependent on Category being populate, but why is my "Category" not showing the correct default selection in Edit mode?

 

For reference:

 

Items

DefaultSelectedItems

Category

Distinct('Request Types',Category)

{Result: LookUp('Request Types',Identifier=ThisItem.'Request Type'.Identifier).Category}

Type

Distinct(Filter('Request Types',Category = re_RequestCategoryValue.Selected.Result),Type)

{Result: LookUp('Request Types',Identifier=ThisItem.'Request Type'.Identifier).Type}

Sub-type

Distinct(Filter('Request Types',Type = re_RequestTypeValue.Selected.Result),'Sub-type')

{Result: LookUp('Request Types',Identifier=ThisItem.'Request Type'.Identifier).'Sub-type'}

Request Type

Choices([@Requests].'Request Type')

First(Filter('Request Types',Category = re_RequestCategoryValue.Selected.Result, Type = re_RequestTypeValue.Selected.Result, 'Sub-type' = re_RequestSubTypeValue.Selected.Result))

 

Note: with my DefaultSelectedItems I had thought that I could just put eg: ThisItem.'Request Type'.Category, however this did not work.  Although it does not error, the output is blank when tested in a Label.  I can get the exact lookup field: ThisItem.'Request Type'.Identifier, but not the other Request Type fields.

 

Note: the Orange text in the combobox datacards is a label where the value is eg: LookUp('Request Types',Identifier=ThisItem.'Request Type'.Identifier).Category, to show that the result/output of the lookup is not blank.

1 REPLY 1
Sandie
Helper III
Helper III

Bump

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (77,398)